Skip to content

Commit

Permalink
feat: add usage instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnowack committed Feb 23, 2024
1 parent 5ff1592 commit 43436fa
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface RemoveParameters {
path: string,
}
type ScriptParameters = AddParameters | UpdateParameters | CommitParameters | RemoveParameters
function getParameters(): ScriptParameters {
function getParameters(): ScriptParameters | null {
const [type, ...args] = process.argv.slice(2)

if (type === 'add') {
Expand Down Expand Up @@ -51,11 +51,20 @@ function getParameters(): ScriptParameters {
return { type, path }
}

throw new Error(`Invalid type: ${type}`)
if (type !== 'help' && type !== '--help' && type !== '-h' && type != null) {
console.log(`Unknown command: ${type}\n`)
}
console.log('Usage: blend add <repo> <remotePath> <localPath>')
console.log(' blend update')
console.log(' blend commit <localPath> <message>')
console.log(' blend remove <path>')
return null
}

const start = async () => {
const parameters = getParameters()
if (parameters == null) return

if (parameters.type === 'add') {
await commands.add(parameters.repo, parameters.remotePath, parameters.localPath)
} else if (parameters.type === 'update') {
Expand Down

0 comments on commit 43436fa

Please sign in to comment.