Tauri getMatches
2024-01-31 16:49 更新
getMatches():
Promise
<CliMatches
>解析提供给当前进程的参数,并使用 中定义的配置 tauri.cli
获取匹配项tauri.conf.json
例
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
}
Since: 1.0.0
Returns: Promise
<CliMatches
>
以上内容是否对您有帮助:
更多建议: