import { Command } from "https://dotland.deno.dev/x/cliffy@v0.12.0/packages/command/mod.ts";
Base command implementation without pre configured command's and option's.
Properties
Methods
Match commands and arguments from command line arguments.
Don't throw an error if the command was called without arguments.
Set default command. The default command will be called if no action handler is registered.
Handle error. If .throwErrors()
was called all error's will be thrown, otherwise Deno.exit(1)
will be called.
Get sub-command with given name.
Get environment variable with given name.
Get global option from parent command's by name.
Get parent command from global executed command. Be sure, to call this method only inside an action handler. Unless this or any child command was executed, this method returns always undefined.
Checks whether the command has a sub-command with given name or not.
Checks whether the command has an environment variable with given name or not.
Checks whether the command has an option with given name or not.
Parse command line arguments and execute matched command.
If enabled, all arguments starting from the first non option argument will be interpreted as raw argument.
For example:
command --debug-level warning server --port 80
Will result in:
- options: {debugLevel: 'warning'}
- args: ['server', '--port', '80']
Throw error's instead of calling Deno.exit()
to handle error's manually.
This has no effect for parent commands. Only for the command on which this method was called and all child commands.
Disable parsing arguments. If enabled the raw arguments will be passed to the action handler. This has no effect for parent or child commands. Only for the command on which this method was called.