Skip to content

Instantly share code, notes, and snippets.

@carsonfarmer
Created May 11, 2019 06:14
Show Gist options
  • Save carsonfarmer/e11524ef473a30b259bafa2af5bd2fb8 to your computer and use it in GitHub Desktop.
Save carsonfarmer/e11524ef473a30b259bafa2af5bd2fb8 to your computer and use it in GitHub Desktop.
Initial stub cmd-line tool
#!/usr/bin/env node
const cli = require('cac')('txtl')
const { log } = console
// Create 'default' chat command
cli.command('', 'Starts an interactive chat session in a thread.')
.action((opts) => {
log('do something')
})
.option('--thread [thread]', 'Thread ID. Omit to use the \'default\' thread.', {
default: 'default',
type: [String]
})
// Display help message when `-h` or `--help` appears
cli.help()
// Display version number when `-v` or `--version` appears
cli.version('1.0.0')
// Parse stdin
cli.parse()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment