import { Command } from "https://deno.land/x/license@1.0.3/deps/cmd.ts";
Define option with flags
, description
and optional
coercion fn
.
The flags
string should contain both the short and long flags,
separated by comma, a pipe or space. The following are all valid
all will output this way when --help
is used.
"-p, --pepper" "-p|--pepper" "-p --pepper"
Examples:
// simple boolean defaulting to undefined
program.option('-p, --pepper', 'add pepper');
program.pepper
// => undefined
--pepper
program.pepper
// => true
// simple boolean defaulting to true (unless non-negated option is also defined)
program.option('-C, --no-cheese', 'remove cheese');
program.cheese
// => true
--no-cheese
program.cheese
// => false
// required argument
program.option('-C, --chdir <path>', 'change the working directory');
--chdir /tmp
program.chdir
// => "/tmp"
// optional argument
program.option('-c, --cheese [type]', 'add cheese [marble]');