pyrocko.squirrel.tool.cli¶
Squirrel command line tool main program.
Functions
|
Setup and run Squirrel-based application. |
- run(args=None, command=None, subcommands=[], description='\nPyrocko Squirrel based script.\n\nRun with --help to get further help.', **kwargs)[source]¶
Setup and run Squirrel-based application.
The implementation of the tool can be provided by one or multiple
SquirrelCommand
instances. This driver function sets up aSquirrelArgumentParser
, and processes command line arguments, and dispatches execution to the selected command or subcommand. The program is set up to provide and automatically handle--help
,--loglevel
, and--progress
. If an exception of typepyrocko.squirrel.error.SquirrelError
orpyrocko.squirrel.error.ToolError
is caught, the error is logged and the program is terminated with exit code 1.- Parameters:
args (
list
ofstr
) – Arguments passed toparse_args()
. By default uses py:attr:sys.argv.command (
SquirrelCommand
or module) – Implementation of the command. It must providesetup(parser)
andrun(parser, args)
.subcommands (
list
ofSquirrelCommand
instances or modules) – Configures the program to offer multiple subcommands. The command to execute is selected with the first argument passed toargs
. Implementations must providemake_subparser(subparsers)
,setup(parser)
, andrun(parser, args)
.description (str) – Description of the program.