@tauri-apps/plugin-cli
Parse arguments from your Command Line Interface.
Functions
Section titled “Functions”getMatches()
Section titled “getMatches()”function getMatches(): Promise<CliMatches>;Defined in: plugins/cli/guest-js/index.ts:77
Parse the arguments provided to the current process and get the matches using the configuration defined tauri.cli in tauri.conf.json
Example
Section titled “Example”import { getMatches } from '@tauri-apps/plugin-cli';const matches = await getMatches();if (matches.subcommand?.name === 'run') { // `./your-app run $ARGS` was executed const args = matches.subcommand?.matches.args if ('debug' in args) { // `./your-app run --debug` was executed }} else { const args = matches.args // `./your-app $ARGS` was executed}Returns
Section titled “Returns”A promise resolving to the parsed CLI matches.
2.0.0
Interfaces
Section titled “Interfaces”ArgMatch
Section titled “ArgMatch”Defined in: plugins/cli/guest-js/index.ts:18
The resolution of a single CLI argument match.
2.0.0
Properties
Section titled “Properties”| Property | Type | Description | Defined in |
|---|---|---|---|
occurrences |
number |
Number of occurrences | plugins/cli/guest-js/index.ts:28 |
value |
string | boolean | string[] | null |
string if takes value boolean if flag string[] or null if takes multiple values | plugins/cli/guest-js/index.ts:24 |
CliMatches
Section titled “CliMatches”Defined in: plugins/cli/guest-js/index.ts:48
The resolved matches of the CLI arguments and, if any, its matched subcommand.
2.0.0
Properties
Section titled “Properties”| Property | Type | Description | Defined in |
|---|---|---|---|
args |
Record<string, ArgMatch> |
The matched arguments, keyed by argument name. | plugins/cli/guest-js/index.ts:50 |
subcommand |
SubcommandMatch | null |
The matched subcommand, or null if no subcommand was invoked. |
plugins/cli/guest-js/index.ts:52 |
SubcommandMatch
Section titled “SubcommandMatch”Defined in: plugins/cli/guest-js/index.ts:36
The result of matching a subcommand of the CLI definition.
2.0.0
Properties
Section titled “Properties”| Property | Type | Description | Defined in |
|---|---|---|---|
matches |
CliMatches |
The argument matches of the subcommand, resolved the same way as the parent command’s matches. | plugins/cli/guest-js/index.ts:40 |
name |
string |
The name of the matched subcommand. | plugins/cli/guest-js/index.ts:38 |
© 2026 Tauri Contributors. CC-BY / MIT