@tauri-apps/plugin-cli
Parse arguments from your Command Line Interface.
Interfaces
ArgMatch
Since
2.0.0
Properties
CliMatches
Since
2.0.0
Properties
Property | Type | Defined in |
---|---|---|
args | Record <string , ArgMatch > | Source: undefined |
subcommand | null | SubcommandMatch | Source: undefined |
SubcommandMatch
Since
2.0.0
Properties
Property | Type | Defined in |
---|---|---|
matches | CliMatches | Source: undefined |
name | string | Source: undefined |
Functions
getMatches()
function getMatches(): Promise<CliMatches>
Parse the arguments provided to the current process and get the matches using the configuration defined tauri.cli
in tauri.conf.json
Returns
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}
Since
2.0.0
Source: undefined
Tauri 中文网 - 粤ICP备13048890号