CLI
info
                                    
                                    - npm
- Yarn
- pnpm
- Cargo
npm run tauri info
 
                            yarn tauri info
pnpm tauri info
 
                            cargo tauri info
 
                            
            用法: cargo-tauri info [选项]
选项:
      --interactive  交互模式可应用自动修复功能
  -v, --verbose...   启用详细日志记录
  -h, --help         打印帮助
  -V, --version      打印版本
        
    它显示了有关环境、Rust、Node.js 及其版本以及一些相关配置的简明信息列表。
当您需要快速了解您的应用程序时,该命令非常有用。在请求帮助时,您可以与我们分享这份报告。
init
- npm
- Yarn
- pnpm
- Cargo
npm run tauri init
 
                            yarn tauri init
pnpm tauri init
 
                            cargo tauri init
 
                            
    用法: cargo-tauri init [选项]
选项:
      --ci
          跳过值提示
  -v, --verbose...
          启用详细日志记录
  -f, --force
          强制init覆盖src-tauri文件夹
  -l, --log
          启用日志记录
  -d, --directory <DIRECTORY>
          设置启动时的目标目录 [默认:/home/runner/work/tauri-docs/tauri-docs]
  -t, --tauri-path <TAURI_PATH>
          要使用的 Tauri 项目的路径(相对于 cwd)
  -A, --app-name <APP_NAME>
          您的 Tauri 应用程序名称
  -W, --window-title <WINDOW_TITLE>
          Tauri 应用程序的窗口标题
  -D, --dist-dir <DIST_DIR>
          web资源位置,相对于 <project-dir>/src-tauri
  -P, --dev-path <DEV_PATH>
          开发服务器的网址
      --before-dev-command <BEFORE_DEV_COMMAND>
          在 `tauri dev` 启动前运行 shell 命令
      --before-build-command <BEFORE_BUILD_COMMAND>
          在 `tauri build`启动前运行 shell 命令
  -h, --help
          打印帮助
  -V, --version
          打印版本
plugin init
- npm
- Yarn
- pnpm
- Cargo
npm run tauri plugin init
 
                            yarn tauri plugin init
pnpm tauri plugin init
 
                            cargo tauri plugin init
 
                            
    用法: cargo-tauri plugin init [选项] --name <插件名称>
选项:
  -n, --name <PLUGIN_NAME>       您的 Tauri 插件名称
  -v, --verbose...               启用详细日志记录
      --api                      使用 TypeScript API 初始化 Tauri 插件
  -d, --directory <DIRECTORY>    设置启动时的目标目录 [默认:/home/runner/work/tauri-docs/tauri-docs]
  -t, --tauri-path <TAURI_PATH>  要使用的 Tauri 项目的路径(相对于 cwd)
  -a, --author <AUTHOR>          作者名字
  -h, --help                     打印帮助
  -V, --version                  打印版本
dev
- npm
- Yarn
- pnpm
- Cargo
npm run tauri dev
 
                            yarn tauri dev
pnpm tauri dev
 
                            cargo tauri dev
 
                            
    用法: cargo-tauri dev [选项] [参数]...
参数:
  [ARGS]...  传递给运行程序的命令行参数。在"--"之后的参数会传递给应用程序
选项:
  -r, --runner <RUNNER>           用于运行应用程序的二进制文件
  -v, --verbose...                启用详细日志记录
  -t, --target <TARGET>           针对三个目标进行构建
  -f, --features [<FEATURES>...]  要激活的cargo功能列表
  -e, --exit-on-panic             遇到错误时退出
  -c, --config <CONFIG>           要与tauri.conf.json合并的JSON字符串或JSON文件路径
      --release                   在发布模式下运行代码
      --no-watch                  禁用文件监视器
      --no-dev-server             禁用静态文件的开发服务器
      --port <PORT>               指定静态文件的开发服务器端口。默认为 1430 也可使用 `TAURI_DEV_SERVER_PORT` 环境变量设置
  -h, --help                      打印帮助
  -V, --version                   打印版本
该命令将在开发模式下打开 WebView。它会使用 src-tauri/tauri.conf.json 文件中的 build.devPath 属性。
如果您在 build.beforeDevCommand 属性中输入了命令,该命令将在 dev 命令之前执行。
如果不使用 build.beforeDevCommand,请确保您的 build.devPath 正确无误,如果使用开发服务器,请确保在使用此命令前服务器已启动。
build
- npm
- Yarn
- pnpm
- Cargo
npm run tauri build
 
                            yarn tauri build
pnpm tauri build
 
                            cargo tauri build
 
                            
    用法: cargo-tauri build [选项] [参数]...
参数:
  [ARGS]...
          传递给运行程序的命令行参数
选项:
  -r, --runner <RUNNER>
          用于构建应用程序的二进制文件,默认为`cargo`。
  -v, --verbose...
          启用详细日志记录
  -d, --debug
          使用调试模式构建
  -t, --target <TARGET>
          针对三个目标进行构建.
          
          它必须是 `$rustc --print target-list` 或 `universal-apple-darwin` 为通用 macOS 应用程序输出的值之一。
          
          请注意,编译通用 macOS 应用程序需要同时安装 `aarch64-apple-darwin` 和 `x86_64-apple-darwin` 目标。
  -f, --features [<FEATURES>...]
          用空格或逗号分隔的要激活的功能列表
  -b, --bundles [<BUNDLES>...]
          以空格或逗号分隔的要打包的包列表。
          
          每个包在 MacOS 上必须是 `deb`、`appimage`、`msi`、`app` 或 `dmg`,在所有平台上必须是 `updater`。如果指定了`none`,打包将被跳过。
          
          请注意,"updater "包不会自动添加,因此如果启用了更新程序,则必须指定该包。
  -c, --config <CONFIG>
          要与tauri.conf.json合并的JSON字符串或JSON文件路径
      --ci
          跳过值提示
  -h, --help
          打印帮助(使用"-h "查看摘要)
  -V, --version
          打印版本
该命令将在生产模式下或调试模式下(如果使用了 --debug 标志)打包应用程序。它会使用 src-tauri/tauri.conf.json 文件中的 build.distDir 属性。
如果在 build.beforeBuildCommand 属性中输入了命令,则该命令将在构建命令之前执行。
icon
- npm
- Yarn
- pnpm
- Cargo
npm run tauri icon
 
                            yarn tauri icon
pnpm tauri icon
 
                            cargo tauri icon
 
                            
    用法: cargo-tauri icon [选项] [输入]
参数:
  [输入]  源图标的路径(png,1024x1024px,透明)[默认:./app-icon.png]
选项:
  -o, --output <输出>  输出目录。默认:tauri.conf.json 文件旁边的 "icon "目录
  -v, --verbose...       启用详细日志记录
  -p, --png <PNG>        要生成的自定义 PNG 图标尺寸。设置后,将不生成默认图标
  -h, --help             打印帮助
  -V, --version          打印版本
更多信息,请查看完整的 Tauri图标指南。
completions
- npm
- Yarn
- pnpm
- Cargo
npm run tauri completions
 
                            yarn tauri completions
pnpm tauri completions
 
                            cargo tauri completions
 
                            
    用法: cargo-tauri completions [选项] --shell <SHELL>
选项:
  -s, --shell <SHELL>    用于生成完成脚本的 Shell。[可能的值:bash、elvish、fish、powershell、zsh]
  -v, --verbose...       启用详细日志记录
  -o, --output <OUTPUT>  Shell 自动补全的输出文件。默认情况下,补全内容会输出到标准输出(stdout)中。
  -h, --help             打印帮助
  -V, --version          打印版本
    
Tauri CLI 可以为 Bash、Zsh、PowerShell 和 Fish 生成shell自动补全。
以下是配置 Bash、Zsh 和 PowerShell 的一些指令。如果遇到问题,请按照所使用的 Shell 的指令进行操作。请注意,为了安全起见,建议在执行生成的自动补全脚本之前检查其内容。
Bash
获取 Bash 的自动补全内容,并移动到一个已知的文件夹中:
- npm
- Yarn
- pnpm
- Cargo
npm run tauri completions -- --shell bash > tauri.sh
mv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash 
                                
 
                            yarn tauri completions --shell bash > tauri.sh
mv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash
pnpm tauri completions --shell bash > tauri.sh
mv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash
 
                            cargo tauri completions --shell bash > tauri.sh
mv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash
 
                            将以下内容添加到 .bashrc 中,加载自动补全脚本:
source /usr/local/etc/bash_completion.d/tauri.bash
Zsh
获取 Zsh 的自动补全内容,并将其移动到一个已知的文件夹中。
- npm
- Yarn
- pnpm
- Cargo
npm run tauri completions -- --shell zsh > completions.zsh
mv completions.zsh $HOME/.completions/_tauri 
                                
 
                            yarn tauri completions --shell zsh > completions.zsh
mv completions.zsh $HOME/.completions/_tauri
pnpm tauri completions --shell zsh > completions.zsh
mv completions.zsh $HOME/.completions/_tauri
 
                            cargo tauri completions --shell zsh > completions.zsh
mv completions.zsh $HOME/.completions/_tauri
 
                            使用 fpath 加载自动补全文件夹,将以下内容添加到 .zshrc 文件中。
fpath=(~/.completions $fpath)
autoload -U compinit
PowerShell
获取PowerShell的自动补全内容,并将其添加到 $profile 文件中,以在所有会话中执行
- npm
- Yarn
- pnpm
- Cargo
npm run tauri completions -- --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")
Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"' 
                                
 
                            yarn tauri completions --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")
Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"'
pnpm tauri completions --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")
Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"'
 
                            cargo tauri completions --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")
Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"'
 
                            version
该命令将显示 Tauri 的当前版本。
- npm
- Yarn
- pnpm
- Cargo
npm run tauri --version
 
                            yarn tauri --version
pnpm tauri --version
 
                            cargo tauri --version
 
                            CLI用法
通过完整指南了解更多使用方法。
