refactor: enhance the descriptions of CLI commands, closes #7572 (#7952)

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
Amr Bashir 2023-10-16 15:44:23 +03:00 committed by GitHub
parent 46dcb94110
commit 2fe8782ad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 49 additions and 28 deletions

View File

@ -17,7 +17,7 @@ use crate::{
use std::{collections::HashMap, process::Command};
#[derive(Debug, Parser)]
#[clap(about = "Installs a plugin on the project")]
#[clap(about = "Add a tauri plugin to the project")]
pub struct Options {
/// The plugin to add.
plugin: String,

View File

@ -26,7 +26,10 @@ use tauri_bundler::bundle::{bundle_project, Bundle, PackageType};
use tauri_utils::platform::Target;
#[derive(Debug, Clone, Parser)]
#[clap(about = "Tauri build")]
#[clap(
about = "Build your app in release mode and generate bundles and installers",
long_about = "Build your app in release mode and generate bundles and installers. It makes use of the `build.distDir` property from your `tauri.conf.json` file. It also runs your `build.beforeBuildCommand` which usually builds your frontend into `build.distDir`. This will also run `build.beforeBundleCommand` before generating the bundles and installers of your app."
)]
pub struct Options {
/// Binary to use to build the application, defaults to `cargo`
#[clap(short, long)]

View File

@ -13,7 +13,7 @@ use std::{fs::write, path::PathBuf};
const PKG_MANAGERS: &[&str] = &["cargo", "pnpm", "npm", "yarn"];
#[derive(Debug, Clone, Parser)]
#[clap(about = "Shell completions")]
#[clap(about = "Generate Tauri CLI shell completions for Bash, Zsh, PowerShell or Fish")]
pub struct Options {
/// Shell to generate a completion script for.
#[clap(short, long, verbatim_doc_comment)]

View File

@ -39,7 +39,11 @@ const KILL_CHILDREN_SCRIPT: &[u8] = include_bytes!("../scripts/kill-children.sh"
pub const TAURI_DEV_WATCHER_GITIGNORE: &[u8] = include_bytes!("../tauri-dev-watcher.gitignore");
#[derive(Debug, Clone, Parser)]
#[clap(about = "Tauri dev", trailing_var_arg(true))]
#[clap(
about = "Run your app in development mode",
long_about = "Run your app in development mode with hot-reloading for the Rust code. It makes use of the `build.devPath` property from your `tauri.conf.json` file. It also runs your `build.beforeDevCommand` which usually starts your frontend devServer.",
trailing_var_arg(true)
)]
pub struct Options {
/// Binary to use to run the application
#[clap(short, long)]

View File

@ -39,7 +39,7 @@ struct PngEntry {
}
#[derive(Debug, Parser)]
#[clap(about = "Generates various icons for all major platforms")]
#[clap(about = "Generate various icons for all major platforms")]
pub struct Options {
// TODO: Confirm 1240px
/// Path to the source icon (png, 1240x1240px with transparency).

View File

@ -200,7 +200,9 @@ impl Section<'_> {
}
#[derive(Debug, Parser)]
#[clap(about = "Shows information about Tauri dependencies and project configuration")]
#[clap(
about = "Show a concise list of information about the environment, Rust, Node.js and their versions as well as a few relevant project configurations"
)]
pub struct Options {
/// Interactive mode to apply automatic fixes.
#[clap(long)]

View File

@ -30,7 +30,7 @@ const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/app");
const TAURI_CONF_TEMPLATE: &str = include_str!("../templates/tauri.conf.json");
#[derive(Debug, Parser)]
#[clap(about = "Initializes a Tauri project")]
#[clap(about = "Initialize a Tauri project in an existing directory")]
pub struct Options {
/// Skip prompting for values
#[clap(long)]

View File

@ -98,20 +98,20 @@ pub(crate) struct Cli {
#[derive(Subcommand)]
enum Commands {
Build(build::Options),
Dev(dev::Options),
Add(add::Options),
Icon(icon::Options),
Info(info::Options),
Init(init::Options),
Plugin(plugin::Cli),
Signer(signer::Cli),
Completions(completions::Options),
Dev(dev::Options),
Build(build::Options),
Android(mobile::android::Cli),
#[cfg(target_os = "macos")]
Ios(mobile::ios::Cli),
/// Migrate from v1 to v2
Migrate,
Info(info::Options),
Add(add::Options),
Plugin(plugin::Cli),
Icon(icon::Options),
Signer(signer::Cli),
Completions(completions::Options),
}
fn format_error<I: CommandFactory>(err: clap::Error) -> clap::Error {

View File

@ -29,7 +29,10 @@ use cargo_mobile2::{
use std::env::{set_current_dir, set_var};
#[derive(Debug, Clone, Parser)]
#[clap(about = "Android build")]
#[clap(
about = "Build your app in release mode for Android and generate APKs and AABs",
long_about = "Build your app in release mode for Android and generate APKs and AABs. It makes use of the `build.distDir` property from your `tauri.conf.json` file. It also runs your `build.beforeBuildCommand` which usually builds your frontend into `build.distDir`."
)]
pub struct Options {
/// Builds with the debug flag
#[clap(short, long)]

View File

@ -44,7 +44,10 @@ const WEBVIEW_CLASS_INIT: &str =
"this.settings.mixedContentMode = android.webkit.WebSettings.MIXED_CONTENT_ALWAYS_ALLOW";
#[derive(Debug, Clone, Parser)]
#[clap(about = "Android dev")]
#[clap(
about = "Run your app in development mode on Android",
long_about = "Run your app in development mode on Android with hot-reloading for the Rust code. It makes use of the `build.devPath` property from your `tauri.conf.json` file. It also runs your `build.beforeDevCommand` which usually starts your frontend devServer."
)]
pub struct Options {
/// List of cargo features to activate
#[clap(short, long, action = ArgAction::Append, num_args(0..))]

View File

@ -54,7 +54,7 @@ pub struct Cli {
}
#[derive(Debug, Parser)]
#[clap(about = "Initializes a Tauri Android project")]
#[clap(about = "Initialize Android target in the project")]
pub struct InitOptions {
/// Skip prompting for values
#[clap(long)]

View File

@ -30,7 +30,10 @@ use cargo_mobile2::{
use std::{env::set_current_dir, fs};
#[derive(Debug, Clone, Parser)]
#[clap(about = "iOS build")]
#[clap(
about = "Build your app in release mode for iOS and generate IPAs",
long_about = "Build your app in release mode for iOS and generate IPAs. It makes use of the `build.distDir` property from your `tauri.conf.json` file. It also runs your `build.beforeBuildCommand` which usually builds your frontend into `build.distDir`."
)]
pub struct Options {
/// Builds with the debug flag
#[clap(short, long)]

View File

@ -31,7 +31,10 @@ use dialoguer::{theme::ColorfulTheme, Select};
use std::env::{set_current_dir, set_var, var_os};
#[derive(Debug, Clone, Parser)]
#[clap(about = "iOS dev")]
#[clap(
about = "Run your app in development mode on iOS",
long_about = "Run your app in development mode on iOS with hot-reloading for the Rust code. It makes use of the `build.devPath` property from your `tauri.conf.json` file. It also runs your `build.beforeDevCommand` which usually starts your frontend devServer."
)]
pub struct Options {
/// List of cargo features to activate
#[clap(short, long, action = ArgAction::Append, num_args(0..))]

View File

@ -54,7 +54,7 @@ pub struct Cli {
}
#[derive(Debug, Parser)]
#[clap(about = "Initializes a Tauri iOS project")]
#[clap(about = "Initialize iOS target in the project")]
pub struct InitOptions {
/// Skip prompting for values
#[clap(long)]

View File

@ -17,7 +17,7 @@ use std::{
#[clap(
author,
version,
about = "Manage the Android project for Tauri plugins",
about = "Manage the Android project for a Tauri plugin",
subcommand_required(true),
arg_required_else_help(true)
)]

View File

@ -27,7 +27,7 @@ use std::{
pub const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/plugin");
#[derive(Debug, Parser)]
#[clap(about = "Initializes a Tauri plugin project")]
#[clap(about = "Initialize a Tauri plugin project on an existing directory")]
pub struct Options {
/// Name of your Tauri plugin.
/// If not specified, it will be infered from the current directory.

View File

@ -18,7 +18,7 @@ use std::{
#[clap(
author,
version,
about = "Manage the iOS project for Tauri plugins",
about = "Manage the iOS project for a Tauri plugin",
subcommand_required(true),
arg_required_else_help(true)
)]

View File

@ -17,7 +17,7 @@ mod new;
#[clap(
author,
version,
about = "Manage Tauri plugins",
about = "Manage or create Tauri plugins",
subcommand_required(true),
arg_required_else_help(true)
)]

View File

@ -7,7 +7,7 @@ use clap::Parser;
use std::path::PathBuf;
#[derive(Debug, Parser)]
#[clap(about = "Initializes a Tauri plugin project")]
#[clap(about = "Initializes a new Tauri plugin project")]
pub struct Options {
/// Name of your Tauri plugin
plugin_name: String,

View File

@ -11,7 +11,7 @@ use std::path::PathBuf;
use tauri_utils::display_path;
#[derive(Debug, Parser)]
#[clap(about = "Generate keypair to sign files")]
#[clap(about = "Generate a new signing key to sign files")]
pub struct Options {
/// Set private key password when signing
#[clap(short, long)]

View File

@ -12,7 +12,7 @@ mod sign;
#[clap(
author,
version,
about = "Tauri updater signer",
about = "Generate signing keys for Tauri updater or sign files",
subcommand_required(true),
arg_required_else_help(true)
)]