Skip to content

getMatches

Module @netwiv/api/plugins/cli · Kind Function

import { getMatches } from '@netwiv/api/plugins/cli';

Parse the arguments provided to the current process and get the matches using the configuration defined tauri.cli in tauri.conf.json

function getMatches(): Promise<CliMatches>
import { getMatches } from '@netwiv/api/plugins/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
}

Upstream since 2.0.0


Descriptions come from the pinned @tauri-apps/plugin-cli@2.4.1 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.