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​>


以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号