Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 8 commits into from
Oct 16, 2023
2 changes: 1 addition & 1 deletion tooling/cli/src/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion tooling/cli/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
6 changes: 5 additions & 1 deletion tooling/cli/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
4 changes: 3 additions & 1 deletion tooling/cli/src/info/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
16 changes: 8 additions & 8 deletions tooling/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion tooling/cli/src/mobile/android/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
5 changes: 4 additions & 1 deletion tooling/cli/src/mobile/android/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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..))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
5 changes: 4 additions & 1 deletion tooling/cli/src/mobile/ios/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
5 changes: 4 additions & 1 deletion tooling/cli/src/mobile/ios/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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..))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/plugin/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)]
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/plugin/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/plugin/ios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)]
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/plugin/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/signer/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)]
Expand Down