Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Created June 11, 2018 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasG77/6e91c554425f4f66943e72dc07a4bd14 to your computer and use it in GitHub Desktop.
Save ThomasG77/6e91c554425f4f66943e72dc07a4bd14 to your computer and use it in GitHub Desktop.
Docopt in JavaScript
#!/usr/bin/env node
doc = `
Usage:
quick_example.js tcp <host> <port> [--timeout=<seconds>]
quick_example.js serial <port> [--baud=9600] [--timeout=<seconds>]
quick_example.js -h | --help | --version
`;
const {docopt} = require('docopt');
console.log(docopt(doc, {
version: '0.1.1rc'
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment