chore(cli): update clap to 3.1 (#3568)

This commit is contained in:
Lucas Fernandes Nogueira 2022-02-27 17:35:43 -03:00 committed by GitHub
parent 913fb001c6
commit b10a7cfa00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 77 additions and 66 deletions

View File

@ -23,9 +23,9 @@
svelte-hmr "^0.14.7" svelte-hmr "^0.14.7"
"@tauri-apps/api@../../tooling/api/dist": "@tauri-apps/api@../../tooling/api/dist":
version "1.0.0-rc.0" version "1.0.0-rc.1"
dependencies: dependencies:
type-fest "2.8.0" type-fest "2.12.0"
debug@^4.3.2: debug@^4.3.2:
version "4.3.3" version "4.3.3"
@ -262,10 +262,10 @@ svelte@3.35.0:
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.35.0.tgz#e0d0ba60c4852181c2b4fd851194be6fda493e65" resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.35.0.tgz#e0d0ba60c4852181c2b4fd851194be6fda493e65"
integrity sha512-gknlZkR2sXheu/X+B7dDImwANVvK1R0QGQLd8CNIfxxGPeXBmePnxfzb6fWwTQRsYQG7lYkZXvpXJvxvpsoB7g== integrity sha512-gknlZkR2sXheu/X+B7dDImwANVvK1R0QGQLd8CNIfxxGPeXBmePnxfzb6fWwTQRsYQG7lYkZXvpXJvxvpsoB7g==
type-fest@2.8.0: type-fest@2.12.0:
version "2.8.0" version "2.12.0"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.8.0.tgz#39d7c9f9c508df8d6ce1cf5a966b0e6568dcc50d" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.12.0.tgz#ce342f58cab9114912f54b493d60ab39c3fc82b6"
integrity sha512-O+V9pAshf9C6loGaH0idwsmugI2LxVNR7DtS40gVo2EXZVYFgz9OuNtOhgHLdHdapOEWNdvz9Ob/eeuaWwwlxA== integrity sha512-Qe5GRT+n/4GoqCNGGVp5Snapg1Omq3V7irBJB3EaKsp7HWDo5Gv2d/67gfNyV+d5EXD+x/RF5l1h4yJ7qNkcGA==
vite@^2.6.4: vite@^2.6.4:
version "2.6.14" version "2.6.14"

View File

@ -26,6 +26,7 @@ tauri-utils = { version = "1.0.0-rc.2", path = "../../core/tauri-utils", feature
ar = "0.9.0" ar = "0.9.0"
icns = "0.3" icns = "0.3"
image = "0.24.1" image = "0.24.1"
png = "=0.17.3"
libflate = "1.1" libflate = "1.1"
md5 = "0.7.0" md5 = "0.7.0"
anyhow = "1.0" anyhow = "1.0"

63
tooling/cli/Cargo.lock generated
View File

@ -60,9 +60,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.53" version = "1.0.55"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0" checksum = "159bb86af3a200e19a068f4224eae4c8bb2d0fa054c7e5d1cacd5cef95e684cd"
[[package]] [[package]]
name = "ar" name = "ar"
@ -224,9 +224,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.72" version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -270,9 +270,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.0.14" version = "3.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b63edc3f163b3c71ec8aa23f9bd6070f77edbf3d1d198b164afa90ff00e4ec62" checksum = "5177fac1ab67102d8989464efd043c6ff44191b1557ec1ddd489b4f7e1447e77"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
@ -287,9 +287,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "3.0.14" version = "3.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a1132dc3944b31c20dd8b906b3a9f0a5d0243e092d59171414969657ac6aa85" checksum = "01d42c94ce7c2252681b5fed4d3627cc807b13dfc033246bd05d5b252399000e"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",
@ -835,9 +835,9 @@ dependencies = [
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.4" version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"js-sys", "js-sys",
@ -934,9 +934,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]] [[package]]
name = "hmac" name = "hmac"
version = "0.12.0" version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddca131f3e7f2ce2df364b57949a9d47915cfbd35e46cfee355ccebbf794d6a2" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
dependencies = [ dependencies = [
"digest 0.10.3", "digest 0.10.3",
] ]
@ -1250,9 +1250,9 @@ checksum = "7efd1d698db0759e6ef11a7cd44407407399a910c774dd804c64c032da7826ff"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.118" version = "0.2.119"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06e509672465a0504304aa87f9f176f2b2b716ed8fb105ebe5c02dc6dce96a94" checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
[[package]] [[package]]
name = "libflate" name = "libflate"
@ -1351,7 +1351,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43935b78ea0886357ab9259bd227879a54b12a83de261c3270aad584500cba2f" checksum = "43935b78ea0886357ab9259bd227879a54b12a83de261c3270aad584500cba2f"
dependencies = [ dependencies = [
"getrandom 0.2.4", "getrandom 0.2.5",
"rpassword", "rpassword",
"scrypt", "scrypt",
] ]
@ -1433,7 +1433,7 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "729eb334247daa1803e0a094d0a5c55711b85571179f5ec6e53eccfdf7008958" checksum = "729eb334247daa1803e0a094d0a5c55711b85571179f5ec6e53eccfdf7008958"
dependencies = [ dependencies = [
"getrandom 0.2.4", "getrandom 0.2.5",
] ]
[[package]] [[package]]
@ -1670,9 +1670,9 @@ dependencies = [
[[package]] [[package]]
name = "os_pipe" name = "os_pipe"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e3492ebca331b895fe23ed427dce2013d9b2e00c45964f12040b0db38b8ab27" checksum = "2c92f2b54f081d635c77e7120862d48db8e91f7f21cef23ab1b4fe9971c59f55"
dependencies = [ dependencies = [
"libc", "libc",
"winapi 0.3.9", "winapi 0.3.9",
@ -1714,9 +1714,9 @@ dependencies = [
[[package]] [[package]]
name = "pbkdf2" name = "pbkdf2"
version = "0.10.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4628cc3cf953b82edcd3c1388c5715401420ce5524fedbab426bd5aba017434" checksum = "271779f35b581956db91a3e55737327a03aa051e90b1c47aeb189508533adfd7"
dependencies = [ dependencies = [
"digest 0.10.3", "digest 0.10.3",
] ]
@ -2066,7 +2066,7 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [ dependencies = [
"getrandom 0.2.4", "getrandom 0.2.5",
] ]
[[package]] [[package]]
@ -2127,7 +2127,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
dependencies = [ dependencies = [
"getrandom 0.2.4", "getrandom 0.2.5",
"redox_syscall", "redox_syscall",
] ]
@ -2199,9 +2199,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.20.3" version = "0.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b323592e3164322f5b193dc4302e4e36cd8d37158a712d664efae1a5c2791700" checksum = "4fbfeb8d0ddb84706bc597a5574ab8912817c52a397f819e5b614e2265206921"
dependencies = [ dependencies = [
"log", "log",
"ring", "ring",
@ -2353,9 +2353,9 @@ dependencies = [
[[package]] [[package]]
name = "semver" name = "semver"
version = "1.0.5" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0486718e92ec9a68fbed73bb5ef687d71103b142595b406835649bebd33f72c7" checksum = "a4a3381e03edd24287172047536f20cabde766e2cd3e65e6b00fb3af51c4f38d"
[[package]] [[package]]
name = "serde" name = "serde"
@ -2483,9 +2483,9 @@ checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012"
[[package]] [[package]]
name = "sha2" name = "sha2"
version = "0.10.1" version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99c3bd8169c58782adad9290a9af5939994036b76187f7b4f0e6de91dbbfc0ec" checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"cpufeatures", "cpufeatures",
@ -2632,6 +2632,7 @@ dependencies = [
"libflate", "libflate",
"md5", "md5",
"os_pipe", "os_pipe",
"png 0.17.3",
"regex", "regex",
"serde", "serde",
"serde_json", "serde_json",
@ -3015,7 +3016,7 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
dependencies = [ dependencies = [
"getrandom 0.2.4", "getrandom 0.2.5",
"sha1", "sha1",
] ]
@ -3287,9 +3288,9 @@ dependencies = [
[[package]] [[package]]
name = "zeroize" name = "zeroize"
version = "1.5.2" version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c88870063c39ee00ec285a2f8d6a966e5b6fb2becc4e8dac77ed0d370ed6006" checksum = "50344758e2f40e3a1fcfc8f6f91aa57b5f8ebd8d27919fe6451f15aaaf9ee608"
[[package]] [[package]]
name = "zip" name = "zip"

View File

@ -27,7 +27,7 @@ name = "cargo-tauri"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
clap = { version = "3", features = [ "derive" ] } clap = { version = "3.1", features = [ "derive" ] }
anyhow = "1.0" anyhow = "1.0"
tauri-bundler = { version = "1.0.0-rc.2", path = "../bundler" } tauri-bundler = { version = "1.0.0-rc.2", path = "../bundler" }
colored = "2.0" colored = "2.0"

View File

@ -3,10 +3,4 @@
/* auto-generated by NAPI-RS */ /* auto-generated by NAPI-RS */
export class ExternalObject<T> {
readonly '': {
readonly '': unique symbol
[K: symbol]: T
}
}
export function run(args: Array<string>, binName: string | undefined | null, callback: (...args: any[]) => any): void export function run(args: Array<string>, binName: string | undefined | null, callback: (...args: any[]) => any): void

View File

@ -12,7 +12,7 @@ use crate::{
}, },
CommandExt, Result, CommandExt, Result,
}; };
use clap::{AppSettings, Parser}; use clap::Parser;
use anyhow::Context; use anyhow::Context;
use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher}; use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
@ -33,8 +33,7 @@ use std::{
static BEFORE_DEV: OnceCell<Mutex<Arc<SharedChild>>> = OnceCell::new(); static BEFORE_DEV: OnceCell<Mutex<Arc<SharedChild>>> = OnceCell::new();
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[clap(about = "Tauri dev")] #[clap(about = "Tauri dev", trailing_var_arg(true))]
#[clap(setting(AppSettings::TrailingVarArg))]
pub struct Options { pub struct Options {
/// Binary to use to run the application /// Binary to use to run the application
#[clap(short, long)] #[clap(short, long)]

View File

@ -13,7 +13,7 @@ mod interface;
mod plugin; mod plugin;
mod signer; mod signer;
use clap::{AppSettings, FromArgMatches, IntoApp, Parser, Subcommand}; use clap::{FromArgMatches, IntoApp, Parser, Subcommand};
use std::ffi::OsString; use std::ffi::OsString;
@ -37,11 +37,16 @@ pub struct VersionMetadata {
} }
#[derive(Parser)] #[derive(Parser)]
#[clap(author, version, about, bin_name("cargo-tauri"))] #[clap(
#[clap(global_setting(AppSettings::PropagateVersion))] author,
#[clap(global_setting(AppSettings::UseLongFormatForHelpSubcommand))] version,
#[clap(global_setting(AppSettings::NoBinaryName))] about,
#[clap(setting(AppSettings::SubcommandRequiredElseHelp))] bin_name("cargo-tauri"),
subcommand_required(true),
arg_required_else_help(true),
propagate_version(true),
no_binary_name(true)
)]
struct Cli { struct Cli {
#[clap(subcommand)] #[clap(subcommand)]
command: Commands, command: Commands,
@ -58,7 +63,7 @@ enum Commands {
} }
fn format_error<I: IntoApp>(err: clap::Error) -> clap::Error { fn format_error<I: IntoApp>(err: clap::Error) -> clap::Error {
let mut app = I::into_app(); let mut app = I::command();
err.format(&mut app) err.format(&mut app)
} }
@ -80,8 +85,8 @@ where
A: Into<OsString> + Clone, A: Into<OsString> + Clone,
{ {
let matches = match bin_name { let matches = match bin_name {
Some(bin_name) => Cli::into_app().bin_name(bin_name), Some(bin_name) => Cli::command().bin_name(bin_name),
None => Cli::into_app(), None => Cli::command(),
} }
.get_matches_from(args); .get_matches_from(args);

View File

@ -8,7 +8,7 @@ use std::path::Path;
use std::process::exit; use std::process::exit;
fn main() -> tauri_cli::Result<()> { fn main() -> tauri_cli::Result<()> {
let mut args = args_os(); let mut args = args_os().peekable();
let bin_name = match args let bin_name = match args
.next() .next()
.as_deref() .as_deref()
@ -17,7 +17,9 @@ fn main() -> tauri_cli::Result<()> {
.and_then(OsStr::to_str) .and_then(OsStr::to_str)
{ {
Some("cargo-tauri") => { Some("cargo-tauri") => {
if args.by_ref().peekable().peek().and_then(|s| s.to_str()) == Some("tauri") { if args.peek().and_then(|s| s.to_str()) == Some("tauri") {
// remove the extra cargo subcommand
args.next();
Some("cargo tauri".into()) Some("cargo tauri".into())
} else { } else {
Some("cargo-tauri".into()) Some("cargo-tauri".into())

View File

@ -2,15 +2,20 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
use clap::{AppSettings, Parser, Subcommand}; use clap::{Parser, Subcommand};
use crate::Result; use crate::Result;
mod init; mod init;
#[derive(Parser)] #[derive(Parser)]
#[clap(author, version, about = "Manage Tauri plugins")] #[clap(
#[clap(setting(AppSettings::SubcommandRequiredElseHelp))] author,
version,
about = "Manage Tauri plugins",
subcommand_required(true),
arg_required_else_help(true)
)]
pub struct Cli { pub struct Cli {
#[clap(subcommand)] #[clap(subcommand)]
command: Commands, command: Commands,

View File

@ -8,7 +8,7 @@ use crate::{
VersionMetadata, VersionMetadata,
}; };
use anyhow::Context; use anyhow::Context;
use clap::{ArgSettings, Parser}; use clap::Parser;
use handlebars::{to_json, Handlebars}; use handlebars::{to_json, Handlebars};
use heck::{ToKebabCase, ToSnakeCase}; use heck::{ToKebabCase, ToSnakeCase};
use include_dir::{include_dir, Dir}; use include_dir::{include_dir, Dir};
@ -28,7 +28,6 @@ pub struct Options {
api: bool, api: bool,
/// Initializes a Tauri core plugin (internal usage) /// Initializes a Tauri core plugin (internal usage)
#[clap(long, hide(true))] #[clap(long, hide(true))]
#[clap(setting(ArgSettings::Hidden))]
tauri: bool, tauri: bool,
/// Set target directory for init /// Set target directory for init
#[clap(short, long)] #[clap(short, long)]

View File

@ -3,14 +3,19 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
use crate::Result; use crate::Result;
use clap::{AppSettings, Parser, Subcommand}; use clap::{Parser, Subcommand};
mod generate; mod generate;
mod sign; mod sign;
#[derive(Parser)] #[derive(Parser)]
#[clap(author, version, about = "Tauri updater signer")] #[clap(
#[clap(setting(AppSettings::SubcommandRequiredElseHelp))] author,
version,
about = "Tauri updater signer",
subcommand_required(true),
arg_required_else_help(true)
)]
pub struct Cli { pub struct Cli {
#[clap(subcommand)] #[clap(subcommand)]
command: Commands, command: Commands,