mirror of
https://github.com/tauri-apps/tauri-docs.git
synced 2026-01-31 00:35:16 +01:00
1.3 KiB
1.3 KiB
@tauri-apps/api / cli
Module: cli
Parse arguments from your Command Line Interface.
This package is also accessible with window.__TAURI__.cli when build.withGlobalTauri in tauri.conf.json is set to true.
Interfaces
Functions
getMatches
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
Example
import { getMatches } from '@tauri-apps/api/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
Promise<CliMatches>
A promise resolving to the parsed arguments.