mirror of
https://github.com/tauri-apps/tauri-docs.git
synced 2026-01-31 00:35:16 +01:00
feat: autogenerate CLI command docs (#2535)
This commit is contained in:
committed by
GitHub
parent
a1120b0a27
commit
20063e2be8
@@ -15,9 +15,10 @@
|
||||
"build:references": "pnpm --filter js-api-generator run build",
|
||||
"build:releases": "pnpm --filter releases-generator run build",
|
||||
"build:config": "pnpm --filter config-generator run build",
|
||||
"build:cli": "pnpm --filter cli-generator run build",
|
||||
"build:astro": "astro build",
|
||||
"build:i18n": "pnpm --filter docs-i18n-tracker run build",
|
||||
"build": "pnpm dev:setup && pnpm build:references && pnpm build:config && pnpm build:releases && pnpm build:astro && pnpm build:i18n",
|
||||
"build": "pnpm dev:setup && pnpm build:references && pnpm build:config && pnpm build:cli && pnpm build:releases && pnpm build:astro && pnpm build:i18n",
|
||||
"preview": "astro preview"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
100
packages/cli-generator/build.ts
Normal file
100
packages/cli-generator/build.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
import { execSync } from 'node:child_process';
|
||||
import { slug } from 'github-slugger';
|
||||
|
||||
interface Command {
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
function getSubcommands(commandOutput: string): Command[] {
|
||||
const subcommands = [];
|
||||
|
||||
let readingSubcommands = false;
|
||||
for (const line of commandOutput.split('\n').map((l) => l.trim())) {
|
||||
if (readingSubcommands) {
|
||||
if (line.length === 0) {
|
||||
readingSubcommands = false;
|
||||
} else {
|
||||
const subcommand = line.substring(0, line.indexOf(' '));
|
||||
const description = line.substring(subcommand.length).trim();
|
||||
if (subcommand !== 'help') {
|
||||
subcommands.push({ name: subcommand, description });
|
||||
}
|
||||
}
|
||||
}
|
||||
if (line === 'Commands:') {
|
||||
readingSubcommands = true;
|
||||
}
|
||||
}
|
||||
|
||||
return subcommands;
|
||||
}
|
||||
|
||||
function generateCommandDoc(command: string, level: number, subcommandList: Command[]): string {
|
||||
const output = execSync(`pnpm tauri ${command} --help`)
|
||||
.toString()
|
||||
.replace('pnpm run build', 'tauri');
|
||||
const subcommands = getSubcommands(output);
|
||||
|
||||
subcommandList.push(
|
||||
...subcommands.map((subcommand) => ({
|
||||
...subcommand,
|
||||
name: `${command} ${subcommand.name}`,
|
||||
}))
|
||||
);
|
||||
|
||||
const subcommandsDoc =
|
||||
subcommands.length === 0
|
||||
? ''
|
||||
: `\n${subcommands.map(({ name }) => generateCommandDoc(`${command} ${name}`, level + 1, commandList)).join('\n\n')}`;
|
||||
|
||||
const heading = '#'.repeat(level);
|
||||
return `${heading} \`${command}\`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri ${command}"
|
||||
yarn="yarn tauri ${command}"
|
||||
pnpm="pnpm tauri ${command}"
|
||||
cargo="cargo tauri ${command}"
|
||||
/>
|
||||
|
||||
\`\`\`
|
||||
${output}
|
||||
\`\`\`
|
||||
${subcommandsDoc}
|
||||
`;
|
||||
}
|
||||
|
||||
const output = execSync('pnpm tauri --help').toString();
|
||||
const subcommands = getSubcommands(output);
|
||||
|
||||
const commandList: Command[] = [];
|
||||
|
||||
let doc = '';
|
||||
|
||||
for (const command of subcommands) {
|
||||
commandList.push(command);
|
||||
const commandDoc = generateCommandDoc(command.name, 3, commandList);
|
||||
doc += commandDoc;
|
||||
}
|
||||
|
||||
let summary = `| Command | Description |
|
||||
| ---------- | ------------------- |
|
||||
`;
|
||||
|
||||
for (const { name, description } of commandList) {
|
||||
summary += `| [\`${name}\`](#${slug(name)}) | ${description} |\n`;
|
||||
}
|
||||
|
||||
const template = readFileSync('../../src/content/docs/reference/_cli.mdx').toString();
|
||||
|
||||
writeFileSync(
|
||||
'../../src/content/docs/reference/cli.mdx',
|
||||
template.replace(
|
||||
'$LIST_OF_COMMANDS',
|
||||
`${summary}
|
||||
|
||||
${doc}`
|
||||
)
|
||||
);
|
||||
21
packages/cli-generator/package.json
Normal file
21
packages/cli-generator/package.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "cli-generator",
|
||||
"version": "1.0.0",
|
||||
"private": "true",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "tsm ./build.ts"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tauri-apps/cli": "2.0.0-rc.3",
|
||||
"@types/node": "^20.11.20",
|
||||
"github-slugger": "^2.0.0",
|
||||
"tsm": "^2.3.0",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
8
packages/cli-generator/tsconfig.json
Normal file
8
packages/cli-generator/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2021",
|
||||
"esModuleInterop": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
136
pnpm-lock.yaml
generated
136
pnpm-lock.yaml
generated
@@ -71,6 +71,24 @@ importers:
|
||||
specifier: ^0.10.0
|
||||
version: 0.10.1(@astrojs/starlight@0.24.5(patch_hash=kv7yo3q5mkk7b2of2xzi4btao4)(astro@4.13.3(@types/node@22.2.0)(sass@1.77.8)(terser@5.31.0)(typescript@5.5.4)))(astro@4.13.3(@types/node@22.2.0)(sass@1.77.8)(terser@5.31.0)(typescript@5.5.4))
|
||||
|
||||
packages/cli-generator:
|
||||
dependencies:
|
||||
'@tauri-apps/cli':
|
||||
specifier: 2.0.0-rc.3
|
||||
version: 2.0.0-rc.3
|
||||
'@types/node':
|
||||
specifier: ^20.11.20
|
||||
version: 20.14.15
|
||||
github-slugger:
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
tsm:
|
||||
specifier: ^2.3.0
|
||||
version: 2.3.0
|
||||
typescript:
|
||||
specifier: ^5.3.3
|
||||
version: 5.5.4
|
||||
|
||||
packages/config-generator:
|
||||
dependencies:
|
||||
'@types/json-schema':
|
||||
@@ -1273,6 +1291,71 @@ packages:
|
||||
'@surma/rollup-plugin-off-main-thread@2.2.3':
|
||||
resolution: {integrity: sha512-lR8q/9W7hZpMWweNiAKU7NQerBnzQQLvi8qnTDU/fxItPhtZVMbPV3lbCwjhIlNBe9Bbr5V+KHshvWmVSG9cxQ==}
|
||||
|
||||
'@tauri-apps/cli-darwin-arm64@2.0.0-rc.3':
|
||||
resolution: {integrity: sha512-szYCSr/ChbCF+S6Wnr15TYpI2cZR07d+AQOiFGuScP0preM8Pbsk/sb0hfLwqzepjVFFNVWQba9sG7FEW2Y2XA==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@tauri-apps/cli-darwin-x64@2.0.0-rc.3':
|
||||
resolution: {integrity: sha512-BJv6EJOY1DJbRzVtfg8CcBAlnS5OjhBAc5YKjh4BT7EyOcop8HStBSxhL6yjWrUP7eLR1iIsW/uSehVJwzYIdQ==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-rc.3':
|
||||
resolution: {integrity: sha512-fwx805/xL4sF/EdMYqcUHQHzMYwo+OVTBTz5x/JWK8D57rnmLHAP+ZhnfFsZQLRo2QRT2l1Ye3bDyU+QRA1JFA==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@tauri-apps/cli-linux-arm64-gnu@2.0.0-rc.3':
|
||||
resolution: {integrity: sha512-3KauzO1Ls4kuY0nr82S4X8XFxlQAMN+Mqp8LLqvQ+PPMp92XQAkPH7osQdoHIEoW5gsE69U2JaiQ5tHSqNM9og==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@tauri-apps/cli-linux-arm64-musl@2.0.0-rc.3':
|
||||
resolution: {integrity: sha512-ngHS0foffm1xO5gqnDKGeYMKj8ceGmrFP5dDldoaaMQubw1SyFa0pRUjb7fZSYiO7F4SOSa8NYeMqlF9peZmnQ==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@tauri-apps/cli-linux-x64-gnu@2.0.0-rc.3':
|
||||
resolution: {integrity: sha512-0/am9pVvuUHGmz32M8ffz1fpLnc08j3nzcRe5wUdL2AxfT+wKMII+Dn99GtCVgcdDW4jSXDMRUwrBkGocGC2OA==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@tauri-apps/cli-linux-x64-musl@2.0.0-rc.3':
|
||||
resolution: {integrity: sha512-r7mRi8q8TqTFVjb9kAsU7IgwUgno2s8Ip4xwq9psQhlRE3JGEZQmSEcy1jqTjfl6KFh6lJcDR7l+9/EMhL/D3Q==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@tauri-apps/cli-win32-arm64-msvc@2.0.0-rc.3':
|
||||
resolution: {integrity: sha512-2J6KjmDIQCw6HF1X6/yPcd+JLl7pxrH2zVMGmNllaoWhHeByvRobqFWnT7gcdHaA3dGTo432CwWvOgTgrINQpQ==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@tauri-apps/cli-win32-ia32-msvc@2.0.0-rc.3':
|
||||
resolution: {integrity: sha512-8q75CsHDSEDdgi6xPwim+BaQZFCswK2Dn/qL38V3Mh9kmVvC8oGJMPC66bC20dF+v3KWeFm2FNNGQqOSXCveHg==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
|
||||
'@tauri-apps/cli-win32-x64-msvc@2.0.0-rc.3':
|
||||
resolution: {integrity: sha512-qeBRJYalahxEXolekcpZJ/HBrIJacG2NWJBGhhi797mIwnbmlpbHMc8blIJtNNNwVUb2BjXuxKQVfojQ5YYrcg==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@tauri-apps/cli@2.0.0-rc.3':
|
||||
resolution: {integrity: sha512-iNF95pieBmverl1EmQyqh+fhcIClS544fN5Ex5lAbYLTiHZ/gm3lOfVBhF6NPaKd/sfLuy7K1tfDXlHztBfANw==}
|
||||
engines: {node: '>= 10'}
|
||||
hasBin: true
|
||||
|
||||
'@types/acorn@4.0.6':
|
||||
resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==}
|
||||
|
||||
@@ -5119,6 +5202,49 @@ snapshots:
|
||||
magic-string: 0.25.9
|
||||
string.prototype.matchall: 4.0.11
|
||||
|
||||
'@tauri-apps/cli-darwin-arm64@2.0.0-rc.3':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-darwin-x64@2.0.0-rc.3':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-rc.3':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-linux-arm64-gnu@2.0.0-rc.3':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-linux-arm64-musl@2.0.0-rc.3':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-linux-x64-gnu@2.0.0-rc.3':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-linux-x64-musl@2.0.0-rc.3':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-win32-arm64-msvc@2.0.0-rc.3':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-win32-ia32-msvc@2.0.0-rc.3':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-win32-x64-msvc@2.0.0-rc.3':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli@2.0.0-rc.3':
|
||||
optionalDependencies:
|
||||
'@tauri-apps/cli-darwin-arm64': 2.0.0-rc.3
|
||||
'@tauri-apps/cli-darwin-x64': 2.0.0-rc.3
|
||||
'@tauri-apps/cli-linux-arm-gnueabihf': 2.0.0-rc.3
|
||||
'@tauri-apps/cli-linux-arm64-gnu': 2.0.0-rc.3
|
||||
'@tauri-apps/cli-linux-arm64-musl': 2.0.0-rc.3
|
||||
'@tauri-apps/cli-linux-x64-gnu': 2.0.0-rc.3
|
||||
'@tauri-apps/cli-linux-x64-musl': 2.0.0-rc.3
|
||||
'@tauri-apps/cli-win32-arm64-msvc': 2.0.0-rc.3
|
||||
'@tauri-apps/cli-win32-ia32-msvc': 2.0.0-rc.3
|
||||
'@tauri-apps/cli-win32-x64-msvc': 2.0.0-rc.3
|
||||
|
||||
'@types/acorn@4.0.6':
|
||||
dependencies:
|
||||
'@types/estree': 1.0.5
|
||||
@@ -5187,16 +5313,17 @@ snapshots:
|
||||
'@types/node@22.2.0':
|
||||
dependencies:
|
||||
undici-types: 6.13.0
|
||||
optional: true
|
||||
|
||||
'@types/resolve@1.17.1':
|
||||
dependencies:
|
||||
'@types/node': 22.2.0
|
||||
'@types/node': 20.14.15
|
||||
|
||||
'@types/retry@0.12.2': {}
|
||||
|
||||
'@types/sax@1.2.7':
|
||||
dependencies:
|
||||
'@types/node': 17.0.45
|
||||
'@types/node': 20.14.15
|
||||
|
||||
'@types/trusted-types@2.0.7': {}
|
||||
|
||||
@@ -6505,7 +6632,7 @@ snapshots:
|
||||
|
||||
jest-worker@26.6.2:
|
||||
dependencies:
|
||||
'@types/node': 22.2.0
|
||||
'@types/node': 20.14.15
|
||||
merge-stream: 2.0.0
|
||||
supports-color: 7.2.0
|
||||
|
||||
@@ -8003,7 +8130,8 @@ snapshots:
|
||||
|
||||
undici-types@5.26.5: {}
|
||||
|
||||
undici-types@6.13.0: {}
|
||||
undici-types@6.13.0:
|
||||
optional: true
|
||||
|
||||
unicode-canonical-property-names-ecmascript@2.0.0: {}
|
||||
|
||||
|
||||
@@ -2,5 +2,6 @@ packages:
|
||||
- 'packages/i18n-tracker'
|
||||
- 'packages/js-api-generator'
|
||||
- 'packages/config-generator'
|
||||
- 'packages/cli-generator'
|
||||
- 'packages/tauri-typedoc-theme'
|
||||
- 'packages/releases-generator'
|
||||
|
||||
1
src/content/docs/reference/.gitignore
vendored
1
src/content/docs/reference/.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
config.md
|
||||
acl/*.md
|
||||
cli.mdx
|
||||
javascript/*
|
||||
!javascript/index.mdx
|
||||
|
||||
32
src/content/docs/reference/_cli.mdx
Normal file
32
src/content/docs/reference/_cli.mdx
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
title: Command Line Interface
|
||||
sidebar:
|
||||
order: 1
|
||||
tableOfContents:
|
||||
minHeadingLevel: 2
|
||||
maxHeadingLevel: 5
|
||||
---
|
||||
|
||||
import { Tabs, TabItem } from '@astrojs/starlight/components';
|
||||
import CommandTabs from '@components/CommandTabs.astro';
|
||||
|
||||
The Tauri command line interface (CLI) is the way to interact with Tauri throughout the development lifecycle.
|
||||
|
||||
You can add the Tauri CLI to your current project using your package manager of choice:
|
||||
|
||||
<CommandTabs
|
||||
npm="npm install --save-dev @tauri-apps/cli@next"
|
||||
yarn="yarn add -D @tauri-apps/cli@next"
|
||||
pnpm="pnpm add -D @tauri-apps/cli@next"
|
||||
cargo='cargo install tauri-cli --version "^2.0.0-rc"'
|
||||
/>
|
||||
|
||||
:::tip[Developing a Plugin]
|
||||
|
||||
For CLI commands related to developing plugins visit the [Develop a Tauri Plugin guide](/develop/plugins/).
|
||||
|
||||
:::
|
||||
|
||||
## List of Commands
|
||||
|
||||
$LIST_OF_COMMANDS
|
||||
@@ -1,666 +0,0 @@
|
||||
---
|
||||
title: Command Line Interface
|
||||
sidebar:
|
||||
order: 1
|
||||
---
|
||||
|
||||
import { Tabs, TabItem } from '@astrojs/starlight/components';
|
||||
import CommandTabs from '@components/CommandTabs.astro';
|
||||
|
||||
The Tauri command line interface (CLI) is the way to interact with Tauri throughout the development lifecycle.
|
||||
|
||||
You can add the Tauri CLI to your current project using your package manager of choice:
|
||||
|
||||
<CommandTabs
|
||||
npm="npm install --save-dev @tauri-apps/cli@next"
|
||||
yarn="yarn add -D @tauri-apps/cli@next"
|
||||
pnpm="pnpm add -D @tauri-apps/cli@next"
|
||||
cargo='cargo install tauri-cli --version "^2.0.0-rc"'
|
||||
/>
|
||||
{/* TODO: 2.0 */}
|
||||
|
||||
:::tip[Developing a Plugin]
|
||||
|
||||
For CLI commands related to developing plugins visit the [Develop a Tauri Plugin guide](/develop/plugins/).
|
||||
|
||||
:::
|
||||
|
||||
## List of Commands
|
||||
|
||||
| Command | Description |
|
||||
| ----------------------------- | -------------------------------------------------------------------- |
|
||||
| [`build`](#build) | Tauri build |
|
||||
| [`dev`](#dev) | Tauri dev |
|
||||
| [`icon`](#icon) | Generates various icons for all major platforms |
|
||||
| [`info`](#info) | Shows information about Tauri dependencies and project configuration |
|
||||
| [`init`](#init) | Initializes a Tauri project |
|
||||
| [`add`](#add) | Manage Tauri plugins |
|
||||
| [`signer`](#signer) | Tauri updater signer |
|
||||
| [`completions`](#completions) | Shell completions |
|
||||
| [`ios`](#ios) | iOS commands |
|
||||
| [`android`](#android) | Android commands |
|
||||
| [`migrate`](#migrate) | Migrate from v1 to v2 |
|
||||
| [`permission`](#permission) | Manage permissions |
|
||||
| [`capability`](#capability) | Manage permissions |
|
||||
| [`help`](#help) | Print this message or the help of the given subcommand(s) |
|
||||
|
||||
## `build`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri build"
|
||||
yarn="yarn tauri build"
|
||||
pnpm="pnpm tauri build"
|
||||
cargo="cargo tauri build"
|
||||
/>
|
||||
|
||||
```
|
||||
Tauri build
|
||||
|
||||
Usage: cargo tauri build [OPTIONS] [ARGS]...
|
||||
|
||||
Arguments:
|
||||
[ARGS]...
|
||||
Command line arguments passed to the runner
|
||||
|
||||
Options:
|
||||
-r, --runner <RUNNER>
|
||||
Binary to use to build the application, defaults to `cargo`
|
||||
-v, --verbose...
|
||||
Enables verbose logging
|
||||
-d, --debug
|
||||
Builds with the debug flag
|
||||
-t, --target <TARGET>
|
||||
Target triple to build against.
|
||||
It must be one of the values outputted by `$rustc --print target-list` or `universal-apple-darwin` for an universal macOS application.
|
||||
Note that compiling an universal macOS application requires both `aarch64-apple-darwin` and `x86_64-apple-darwin` targets to be installed.
|
||||
-f, --features [<FEATURES>...]
|
||||
Space or comma separated list of features to activate
|
||||
-b, --bundles [<BUNDLES>...]
|
||||
Space or comma separated list of bundles to package.
|
||||
Each bundle must be one of `deb`, `appimage`, `msi`, `app` or `dmg` on MacOS and `updater` on all platforms.
|
||||
Note that the `updater` bundle is not automatically added so you must specify it if the updater is enabled.
|
||||
--no-bundle
|
||||
Bundler will be skipped
|
||||
-c, --config <CONFIG>
|
||||
JSON string or path to JSON file to merge with tauri.conf.json
|
||||
--ci
|
||||
Skip prompting for values
|
||||
-h, --help
|
||||
Print help (see a summary with '-h')
|
||||
-V, --version
|
||||
Print version
|
||||
```
|
||||
|
||||
## `dev`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri dev"
|
||||
yarn="yarn tauri dev"
|
||||
pnpm="pnpm tauri dev"
|
||||
cargo="cargo tauri dev"
|
||||
/>
|
||||
|
||||
```
|
||||
Tauri dev
|
||||
|
||||
Usage: cargo tauri dev [OPTIONS] [ARGS]...
|
||||
|
||||
Arguments:
|
||||
[ARGS]... Command line arguments passed to the runner. Arguments after `--` are passed to the application
|
||||
|
||||
Options:
|
||||
-r, --runner <RUNNER> Binary to use to run the application
|
||||
-v, --verbose... Enables verbose logging
|
||||
-t, --target <TARGET> Target triple to build against
|
||||
-f, --features [<FEATURES>...] List of cargo features to activate
|
||||
-e, --exit-on-panic Exit on panic
|
||||
-c, --config <CONFIG> JSON string or path to JSON file to merge with tauri.conf.json
|
||||
--release Run the code in release mode
|
||||
--no-watch Disable the file watcher
|
||||
--no-dev-server Disable the dev server for static files
|
||||
--port <PORT> Specify port for the dev server for static files. Defaults to 1430 Can also be set using `TAURI_DEV_SERVER_PORT` env var
|
||||
--force-ip-prompt Force prompting for an IP to use to connect to the dev server on mobile
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
This command will open the WebView in development mode. It makes use of the `build.devPath` property from your `tauri.conf.json` file.
|
||||
|
||||
If you have entered a command to the `build.beforeDevCommand` property, this one will be executed before the dev command.
|
||||
|
||||
## `icon`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri icon"
|
||||
yarn="yarn tauri icon"
|
||||
pnpm="pnpm tauri icon"
|
||||
cargo="cargo tauri icon"
|
||||
/>
|
||||
|
||||
```
|
||||
Generates various icons for all major platforms
|
||||
|
||||
Usage: cargo tauri icon [OPTIONS] [INPUT]
|
||||
|
||||
Arguments:
|
||||
[INPUT] Path to the source icon (png, 1240x1240px with transparency) [default: ./app-icon.png]
|
||||
|
||||
Options:
|
||||
-o, --output <OUTPUT> Output directory. Default: 'icons' directory next to the tauri.conf.json file
|
||||
-v, --verbose... Enables verbose logging
|
||||
-p, --png <PNG> Custom PNG icon sizes to generate. When set, the default icons are not generated
|
||||
--ios-color <IOS_COLOR> The background color of the iOS icon - string as defined in the W3C's CSS Color Module Level 4 <https://www.w3.org/TR/css-color-4/> [default: #fff]
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
## `info`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri info"
|
||||
yarn="yarn tauri info"
|
||||
pnpm="pnpm tauri info"
|
||||
cargo="cargo tauri info"
|
||||
/>
|
||||
|
||||
```
|
||||
Shows information about Tauri dependencies and project configuration
|
||||
|
||||
Usage: cargo tauri info [OPTIONS]
|
||||
|
||||
Options:
|
||||
--interactive Interactive mode to apply automatic fixes
|
||||
-v, --verbose... Enables verbose logging
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
`tauri info` shows a concise list of information about the environment, Rust, Node.js and their versions as well as a few relevant project configurations.
|
||||
|
||||
## `init`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri init"
|
||||
yarn="yarn tauri init"
|
||||
pnpm="pnpm tauri init"
|
||||
cargo="cargo tauri init"
|
||||
/>
|
||||
|
||||
```
|
||||
Initializes a Tauri project
|
||||
|
||||
Usage: cargo tauri init [OPTIONS]
|
||||
|
||||
Options:
|
||||
--ci
|
||||
Skip prompting for values
|
||||
-v, --verbose...
|
||||
Enables verbose logging
|
||||
-f, --force
|
||||
Force init to overwrite the src-tauri folder
|
||||
-l, --log
|
||||
Enables logging
|
||||
-d, --directory <DIRECTORY>
|
||||
Set target directory for init [default: C:\Users\Fabian-Lars]
|
||||
-t, --tauri-path <TAURI_PATH>
|
||||
Path of the Tauri project to use (relative to the cwd)
|
||||
-A, --app-name <APP_NAME>
|
||||
Name of your Tauri application
|
||||
-W, --window-title <WINDOW_TITLE>
|
||||
Window title of your Tauri application
|
||||
-D, --dist-dir <DIST_DIR>
|
||||
Web assets location, relative to <project-dir>/src-tauri
|
||||
-P, --dev-path <DEV_PATH>
|
||||
Url of your dev server
|
||||
--before-dev-command <BEFORE_DEV_COMMAND>
|
||||
A shell command to run before `tauri dev` kicks in
|
||||
--before-build-command <BEFORE_BUILD_COMMAND>
|
||||
A shell command to run before `tauri build` kicks in
|
||||
-h, --help
|
||||
Print help
|
||||
-V, --version
|
||||
Print version
|
||||
```
|
||||
|
||||
## `add`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri add"
|
||||
yarn="yarn tauri add"
|
||||
pnpm="pnpm tauri add"
|
||||
cargo="cargo tauri add"
|
||||
/>
|
||||
|
||||
```
|
||||
Installs a plugin on the project
|
||||
|
||||
Usage: cargo tauri add [OPTIONS] <PLUGIN>
|
||||
|
||||
Arguments:
|
||||
<PLUGIN> The plugin to add
|
||||
|
||||
Options:
|
||||
-t, --tag <TAG> Git tag to use
|
||||
-v, --verbose... Enables verbose logging
|
||||
-r, --rev <REV> Git rev to use
|
||||
-b, --branch <BRANCH> Git branch to use
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
## `signer`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri signer"
|
||||
yarn="yarn tauri signer"
|
||||
pnpm="pnpm tauri signer"
|
||||
cargo="cargo tauri signer"
|
||||
/>
|
||||
|
||||
```
|
||||
Tauri updater signer
|
||||
|
||||
Usage: cargo tauri signer [OPTIONS] <COMMAND>
|
||||
|
||||
Commands:
|
||||
sign Sign a file
|
||||
generate Generate keypair to sign files
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
|
||||
Options:
|
||||
-v, --verbose... Enables verbose logging
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
## `completions`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri completions"
|
||||
yarn="yarn tauri completions"
|
||||
pnpm="pnpm tauri completions"
|
||||
cargo="cargo tauri completions"
|
||||
/>
|
||||
|
||||
```
|
||||
Shell completions
|
||||
|
||||
Usage: cargo tauri completions [OPTIONS] --shell <SHELL>
|
||||
|
||||
Options:
|
||||
-s, --shell <SHELL> Shell to generate a completion script for. [possible values: bash, elvish, fish, powershell, zsh]
|
||||
-v, --verbose... Enables verbose logging
|
||||
-o, --output <OUTPUT> Output file for the shell completions. By default the completions are printed to stdout
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
The Tauri CLI can generate shell completions for Bash, Zsh, PowerShell and Fish.
|
||||
|
||||
Here are some instructions to configure Bash, Zsh and PowerShell. If you face an issue, please follow your shell's instructions instead. Note that it is recommended to check the generated completions script before executing it for security reasons.
|
||||
|
||||
### Bash
|
||||
|
||||
Get the Bash completions and move to a known folder:
|
||||
|
||||
<Tabs>
|
||||
<TabItem label="npm">
|
||||
|
||||
```shell
|
||||
npm run tauri completions -- --shell bash > tauri.sh
|
||||
mv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem label="Yarn">
|
||||
|
||||
```shell
|
||||
yarn tauri completions --shell bash > tauri.sh
|
||||
mv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem label="pnpm">
|
||||
|
||||
```shell
|
||||
pnpm tauri completions --shell bash > tauri.sh
|
||||
mv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem label="Cargo">
|
||||
|
||||
```shell
|
||||
cargo tauri completions --shell bash > tauri.sh
|
||||
mv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
Load the completions script by adding the following to `.bashrc`:
|
||||
|
||||
```shell
|
||||
source /usr/local/etc/bash_completion.d/tauri.bash
|
||||
```
|
||||
|
||||
### Zsh
|
||||
|
||||
Get the Zsh completions and move to a known folder:
|
||||
|
||||
<Tabs>
|
||||
<TabItem label="npm">
|
||||
|
||||
```shell
|
||||
npm run tauri completions -- --shell zsh > completions.zsh
|
||||
mv completions.zsh $HOME/.completions/_tauri
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem label="Yarn">
|
||||
|
||||
```shell
|
||||
yarn tauri completions --shell zsh > completions.zsh
|
||||
mv completions.zsh $HOME/.completions/_tauri
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem label="pnpm">
|
||||
|
||||
```shell
|
||||
pnpm tauri completions --shell zsh > completions.zsh
|
||||
mv completions.zsh $HOME/.completions/_tauri
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem label="Cargo">
|
||||
|
||||
```shell
|
||||
cargo tauri completions --shell zsh > completions.zsh
|
||||
mv completions.zsh $HOME/.completions/_tauri
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
Load the completions folder using fpath adding the following to `.zshrc`:
|
||||
|
||||
```shell
|
||||
fpath=(~/.completions $fpath)
|
||||
autoload -U compinit
|
||||
```
|
||||
|
||||
### PowerShell
|
||||
|
||||
Get the PowerShell completions and add it to the `$profile` file to execute it on all sessions:
|
||||
|
||||
<Tabs>
|
||||
<TabItem label="npm">
|
||||
|
||||
```powershell
|
||||
npm run tauri completions -- --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")
|
||||
Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem label="Yarn">
|
||||
|
||||
```powershell
|
||||
yarn tauri completions --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")
|
||||
Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem label="pnpm">
|
||||
|
||||
```powershell
|
||||
pnpm tauri completions --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")
|
||||
Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem label="Cargo">
|
||||
|
||||
```powershell
|
||||
cargo tauri completions --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")
|
||||
Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## `android`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri android"
|
||||
yarn="yarn tauri android"
|
||||
pnpm="pnpm tauri android"
|
||||
cargo="cargo tauri android"
|
||||
/>
|
||||
|
||||
```
|
||||
Android commands
|
||||
|
||||
Usage: cargo tauri android [OPTIONS] <COMMAND>
|
||||
|
||||
Commands:
|
||||
init Initializes a Tauri Android project
|
||||
open Open project in Android Studio
|
||||
dev Android dev
|
||||
build Android build
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
|
||||
Options:
|
||||
-v, --verbose... Enables verbose logging
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
## `ios`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri ios"
|
||||
yarn="yarn tauri ios"
|
||||
pnpm="pnpm tauri ios"
|
||||
cargo="cargo tauri ios"
|
||||
/>
|
||||
|
||||
```
|
||||
iOS commands
|
||||
|
||||
Usage: cargo tauri ios [OPTIONS] <COMMAND>
|
||||
|
||||
Commands:
|
||||
init Initializes a Tauri iOS project
|
||||
open Open project in Xcode
|
||||
dev iOS dev
|
||||
build iOS build
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
|
||||
Options:
|
||||
-v, --verbose... Enables verbose logging
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
## `migrate`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri migrate"
|
||||
yarn="yarn tauri migrate"
|
||||
pnpm="pnpm tauri migrate"
|
||||
cargo="cargo tauri migrate"
|
||||
/>
|
||||
|
||||
```
|
||||
Migrate from v1 to v2
|
||||
|
||||
Usage: cargo tauri migrate [OPTIONS]
|
||||
|
||||
Options:
|
||||
-v, --verbose... Enables verbose logging
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
## `permission`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm tauri permission"
|
||||
yarn="yarn tauri permission"
|
||||
pnpm="pnpm tauri permission"
|
||||
cargo="cargo tauri permission"
|
||||
/>
|
||||
|
||||
```
|
||||
Permission commands
|
||||
|
||||
Usage: cargo tauri permission <COMMAND>
|
||||
|
||||
Commands:
|
||||
new Create a new permission file
|
||||
add Add a permission to capabilities
|
||||
rm Remove a permission file, and its reference from any capability
|
||||
ls List permissions available to your application
|
||||
```
|
||||
|
||||
### `new`
|
||||
|
||||
Create a new permission file
|
||||
|
||||
```
|
||||
Arguments:
|
||||
[IDENTIFIER] Permission identifier
|
||||
|
||||
Options:
|
||||
--description \<DESCRIPTION> Permission description
|
||||
-v, --verbose... Enables verbose logging
|
||||
-a, --allow \<ALLOW> List of commands to allow
|
||||
-d, --deny \<DENY> List of commands to deny
|
||||
--format \<FORMAT> Output file format [default: json] [possible values: json, toml]
|
||||
-o, --out \<OUT> The output file
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
### `add`
|
||||
|
||||
Add a permission to capabilities
|
||||
|
||||
```
|
||||
Arguments:
|
||||
<IDENTIFIER> Permission to add
|
||||
[CAPABILITY] Capability to add the permission to
|
||||
|
||||
Options:
|
||||
-v, --verbose... Enables verbose logging
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
### `rm`
|
||||
|
||||
Remove a permission file, and its reference from any capability
|
||||
|
||||
```
|
||||
Arguments:
|
||||
<IDENTIFIER> Permission to remove
|
||||
|
||||
Options:
|
||||
-v, --verbose... Enables verbose logging
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
### `ls`
|
||||
|
||||
List permissions available to your application
|
||||
|
||||
```
|
||||
Arguments:
|
||||
[PLUGIN] Name of the plugin to list permissions
|
||||
|
||||
Options:
|
||||
-f, --filter \<FILTER> Permission identifier filter
|
||||
-v, --verbose... Enables verbose logging
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
|
||||
```
|
||||
|
||||
## `capability`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm tauri capability"
|
||||
yarn="yarn tauri capability"
|
||||
pnpm="pnpm tauri capability"
|
||||
cargo="cargo tauri capability"
|
||||
/>
|
||||
|
||||
```
|
||||
Migrate from v1 to v2
|
||||
|
||||
Usage: cargo tauri capability [OPTIONS] <COMMAND>
|
||||
|
||||
Commands:
|
||||
new Create a new permission file
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
|
||||
Options:
|
||||
-v, --verbose... Enables verbose logging
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
### `new`
|
||||
|
||||
`Usage: cargo tauri capability new [OPTIONS] [IDENTIFIER]`
|
||||
|
||||
```
|
||||
Arguments:
|
||||
[IDENTIFIER] Capability identifier
|
||||
|
||||
Options:
|
||||
--description <DESCRIPTION> Capability description
|
||||
-v, --verbose... Enables verbose logging
|
||||
--windows <WINDOWS> Capability windows
|
||||
--permission <PERMISSION> Capability permissions
|
||||
--format <FORMAT> Output file format [default: json] [possible values: json, toml]
|
||||
-o, --out <OUT> The output file
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
## `help`
|
||||
|
||||
<CommandTabs
|
||||
npm="npm run tauri help"
|
||||
yarn="yarn tauri help"
|
||||
pnpm="pnpm tauri help"
|
||||
cargo="cargo tauri help"
|
||||
/>
|
||||
|
||||
```
|
||||
Command line interface for building Tauri apps
|
||||
|
||||
Usage: cargo tauri [OPTIONS] <COMMAND>
|
||||
|
||||
Commands:
|
||||
build Tauri build
|
||||
dev Tauri dev
|
||||
icon Generates various icons for all major platforms
|
||||
info Shows information about Tauri dependencies and project configuration
|
||||
init Initializes a Tauri project
|
||||
plugin Manage Tauri plugins
|
||||
signer Tauri updater signer
|
||||
completions Shell completions
|
||||
android Android commands
|
||||
ios iOS commands
|
||||
migrate Migrate from v1 to v2
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
|
||||
Options:
|
||||
-v, --verbose... Enables verbose logging
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
Reference in New Issue
Block a user