The cli module parses the command-line arguments the app was launched
with (a port of @tauri-apps/plugin-cli's JS bindings): getArgv()
returns the raw argv (including the argv[0] executable), and
getMatches() returns the schema-parsed CliMatches — flags to values
(dashed names become camelCase, numbers auto-coerced), bare positionals
collected under _, and subcommands forming a recursive tree
({ name, matches }). Backed by the two plugin:cli|* commands.
Permissions: cli:allow-get-argv, cli:allow-get-matches; the
cli:default set grants both. No scope.
Parsing behavior is driven by the plugin construction options:
cliPlugin({ schema? | subcommands?, booleans? }) — schema is the
upstream clap-shaped declarative description
({ description?, args?, subcommands? }); with no schema the parse falls
back to fully lenient legacy rules. The hello example does not register
this plugin; registration (shaped after
packages/core/src/plugins/cli.ts) looks like:
The hello frontend does not use this module — the following is minimal usage against the schema above, at the API-signature level (not run code from the example app):
plugin:cli|* totals 2 commands:
| Command | API |
|---|---|
get_argv |
getArgv() |
get_matches |
getMatches() |
Full list in the Commands Reference and the API symbol reference.
Applicable version: ztron 0.3.1