janitor: Update clap to 4.0 (+fix some typos)

This commit is contained in:
Tobias Hunger 2022-10-25 15:23:58 +02:00 committed by Tobias Hunger
parent ee39f3802e
commit 2bbf236e25
16 changed files with 57 additions and 62 deletions

View file

@ -19,6 +19,6 @@ path = "main.rs"
[dependencies]
i-slint-compiler = { version = "=0.3.1", path = "../../internal/compiler", features = ["display-diagnostics", "cpp", "rust"]}
clap = { version = "3.2", features = ["derive", "wrap_help"] }
clap = { version = "4.0", features = ["derive", "wrap_help"] }
proc-macro2 = "1.0.11"
spin_on = "0.1"

View file

@ -7,30 +7,30 @@ use i_slint_compiler::*;
use std::io::Write;
#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None)]
struct Cli {
/// Set output format
#[clap(short = 'f', long = "format", default_value = "cpp", action)]
#[arg(short = 'f', long = "format", default_value = "cpp", action)]
format: generator::OutputFormat,
/// Include path for other .slint files
#[clap(short = 'I', name = "include path", number_of_values = 1, action)]
#[arg(short = 'I', name = "include path", number_of_values = 1, action)]
include_paths: Vec<std::path::PathBuf>,
/// Path to .slint file ('-' for stdin)
#[clap(name = "file", action)]
#[arg(name = "file", action)]
path: std::path::PathBuf,
/// The style name ('native' or 'fluent')
#[clap(long, name = "style name", action)]
#[arg(long, name = "style name", action)]
style: Option<String>,
/// Generate a dependency file
#[clap(name = "dependency file", long = "depfile", number_of_values = 1, action)]
#[arg(name = "dependency file", long = "depfile", number_of_values = 1, action)]
depfile: Option<std::path::PathBuf>,
/// Sets the output file ('-' for stdout)
#[clap(name = "file to generate", short = 'o', default_value = "-", action)]
#[arg(name = "file to generate", short = 'o', default_value = "-", action)]
output: std::path::PathBuf,
}

View file

@ -12,7 +12,7 @@ publish = false
[dependencies]
float-cmp = "0.9.0"
clap = { version = "3.1", features = ["derive", "wrap_help"] }
clap = { version = "4.0", features = ["derive", "wrap_help"] }
reqwest = { version = "0.11", features = ["json", "stream"] }
tokio = { version = "1", features = ["full"] }
futures = "0.3"

View file

@ -11,19 +11,19 @@ use std::fmt::Display;
use tokio::io::AsyncWriteExt;
#[derive(Debug, Parser)]
#[clap(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None)]
struct Opt {
/// Figma asscess token
#[clap(short = 't', long = "token")]
/// Figma access token
#[arg(short = 't', long = "token")]
token: String,
/// If present, load the specific node id
#[clap(short = 'n', long = "node")]
#[arg(short = 'n', long = "node")]
node_id: Option<String>,
/// If present, load the specific child node at the specified index
#[clap(long = "child")]
#[arg(long = "child")]
child_index: Option<usize>,
/// If set, don't connect to the network, but use the `figma_output/cache.json`
#[clap(long)]
#[arg(long)]
read_from_cache: bool,
/// Figma file
file: String,

View file

@ -17,7 +17,7 @@ keywords = ["formatter", "gui", "ui", "toolkit"]
[dependencies]
i-slint-compiler = { path = "../../internal/compiler", features = ["display-diagnostics"] }
clap = { version = "3.2", features = ["derive", "wrap_help"] }
clap = { version = "4.0", features = ["derive", "wrap_help"] }
codemap = "0.1"
codemap-diagnostic = "0.1.1"

View file

@ -26,13 +26,13 @@ mod fmt;
mod writer;
#[derive(clap::Parser)]
#[clap(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None)]
struct Cli {
#[clap(name = "path to .slint file(s)", action)]
#[arg(name = "path to .slint file(s)", action)]
paths: Vec<std::path::PathBuf>,
/// modify the file inline instead of printing to stdout
#[clap(short, long, action)]
#[arg(short, long, action)]
inline: bool,
}

View file

@ -69,7 +69,7 @@ slint-interpreter = { version = "=0.3.1", path = "../../internal/interpreter", d
i-slint-backend-selector = { version = "=0.3.1", path="../../internal/backends/selector", optional = true }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
clap = { version = "3.2", features = ["derive", "wrap_help"] }
clap = { version = "4.0", features = ["derive", "wrap_help"] }
crossbeam-channel = "0.5" # must match the version used by lsp-server
lsp-server = "0.6"
once_cell = "1.9.0"

View file

@ -27,9 +27,9 @@ use clap::Parser;
use lsp_server::{Connection, Message, Request, Response};
#[derive(Clone, clap::Parser)]
#[clap(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None)]
struct Cli {
#[clap(
#[arg(
short = 'I',
name = "Add include paths for the import statements",
number_of_values = 1,
@ -38,11 +38,11 @@ struct Cli {
include_paths: Vec<std::path::PathBuf>,
/// The style name for the preview ('native' or 'fluent')
#[clap(long, name = "style name", default_value_t, action)]
#[arg(long, name = "style name", default_value_t, action)]
style: String,
/// The backend used for the preview ('GL' or 'Qt')
#[clap(long, name = "backend", default_value_t, action)]
#[arg(long, name = "backend", default_value_t, action)]
backend: String,
}

View file

@ -16,7 +16,7 @@ homepage = "https://slint-ui.com"
[dependencies]
i-slint-compiler = { path = "../../internal/compiler", features = ["display-diagnostics"] }
clap = { version = "3.2", features = ["derive", "wrap_help"] }
clap = { version = "4.0", features = ["derive", "wrap_help"] }
codemap = "0.1"
codemap-diagnostic = "0.1.1"
spin_on = "0.1"

View file

@ -33,17 +33,17 @@ mod experiments {
}
#[derive(clap::Parser)]
#[clap(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None)]
pub struct Cli {
#[clap(name = "path to .slint file(s)", action)]
#[arg(name = "path to .slint file(s)", action)]
paths: Vec<std::path::PathBuf>,
/// modify the file inline instead of printing to stdout
#[clap(short, long, action)]
#[arg(short, long, action)]
inline: bool,
/// Move all properties declaration to root
#[clap(long, action)]
#[arg(long, action)]
move_declaration: bool,
}

View file

@ -40,7 +40,7 @@ i-slint-backend-selector = { version = "=0.3.1", path="../../internal/backends/s
vtable = { version = "0.1.6", path="../../helper_crates/vtable" }
clap = { version = "3.2", features = ["derive", "wrap_help"] }
clap = { version = "4.0", features = ["derive", "wrap_help"] }
codemap = "0.1"
codemap-diagnostic = "0.1.1"
notify = { version = "5.0.0", default-features = false, features = ["macos_kqueue"] }

View file

@ -17,45 +17,40 @@ use clap::Parser;
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
#[derive(Clone, clap::Parser)]
#[clap(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None)]
struct Cli {
#[clap(
short = 'I',
name = "include path for other .slint files",
number_of_values = 1,
action
)]
#[arg(short = 'I', name = "include path for other .slint files", number_of_values = 1, action)]
include_paths: Vec<std::path::PathBuf>,
/// The .slint file to load ('-' for stdin)
#[clap(name = "path to .slint file", action)]
#[arg(name = "path to .slint file", action)]
path: std::path::PathBuf,
/// The style name ('native' or 'fluent')
#[clap(long, name = "style name", action)]
#[arg(long, name = "style name", action)]
style: Option<String>,
/// The rendering backend
#[clap(long, name = "backend", action)]
#[arg(long, name = "backend", action)]
backend: Option<String>,
/// Automatically watch the file system, and reload when it changes
#[clap(long, action)]
#[arg(long, action)]
auto_reload: bool,
/// Load properties from a json file ('-' for stdin)
#[clap(long, name = "load data file", action)]
#[arg(long, name = "load data file", action)]
load_data: Option<std::path::PathBuf>,
/// Store properties values in a json file at exit ('-' for stdout)
#[clap(long, name = "save data file", action)]
#[arg(long, name = "save data file", action)]
save_data: Option<std::path::PathBuf>,
/// Specify callbacks handler.
/// The first argument is the callback name, and the second argument is a string that is going
/// to be passed to the shell to be executed. Occurences of `$1` will be replaced by the first argument,
/// to be passed to the shell to be executed. Occurrences of `$1` will be replaced by the first argument,
/// and so on.
#[clap(long, value_names(&["callback", "handler"]), number_of_values = 2, action)]
#[arg(long, value_names(&["callback", "handler"]), number_of_values = 2, action)]
on: Vec<String>,
}

View file

@ -12,7 +12,7 @@ publish = false
[dependencies]
const_format = "0.2"
clap = { version = "3.2", features = ["derive", "wrap_help"] }
clap = { version = "4.0", features = ["derive", "wrap_help"] }
cargo_metadata = "0.15"
anyhow = "1.0"
lazy_static = "1.4.0"

View file

@ -509,13 +509,13 @@ impl CargoToml {
#[derive(Debug, clap::Parser)]
pub struct LicenseHeaderCheck {
#[clap(long, action)]
#[arg(long, action)]
fix_it: bool,
#[clap(long, action)]
#[arg(long, action)]
show_all: bool,
#[clap(long, action)]
#[arg(long, action)]
verbose: bool,
}

View file

@ -13,30 +13,30 @@ mod nodepackage;
mod reuse_compliance_check;
#[derive(Debug, clap::Parser)]
#[clap(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None)]
pub enum TaskCommand {
#[clap(name = "check_license_headers")]
#[command(name = "check_license_headers")]
CheckLicenseHeaders(license_headers_check::LicenseHeaderCheck),
#[clap(name = "cppdocs")]
#[command(name = "cppdocs")]
CppDocs(CppDocsCommand),
#[clap(name = "node_package")]
#[command(name = "node_package")]
NodePackage,
#[clap(name = "check_reuse_compliance")]
#[command(name = "check_reuse_compliance")]
ReuseComplianceCheck(reuse_compliance_check::ReuseComplianceCheck),
#[clap(name = "enumdocs")]
#[command(name = "enumdocs")]
EnumDocs,
}
#[derive(Debug, clap::Parser)]
#[clap(name = "xtask")]
#[command(name = "xtask")]
pub struct ApplicationArguments {
#[clap(subcommand)]
#[command(subcommand)]
pub command: TaskCommand,
}
#[derive(Debug, clap::Parser)]
pub struct CppDocsCommand {
#[clap(long, action)]
#[arg(long, action)]
show_warnings: bool,
}

View file

@ -135,9 +135,9 @@ fn is_symlink(path: &Path) -> bool {
fn validate_license_directory(dir: &Path, licenses: &[String], fix_it: bool) -> Result<()> {
let top_dir =
PathBuf::from(".").canonicalize().context("Failed to cannonicalize the top directory")?;
PathBuf::from(".").canonicalize().context("Failed to canonicalize the top directory")?;
let lic_dir = dir.join("LICENSES").canonicalize().with_context(|| {
format!("Failed to cannonicalize \"{}\"", dir.join("LICENSES").to_string_lossy())
format!("Failed to canonicalize \"{}\"", dir.join("LICENSES").to_string_lossy())
})?;
if !lic_dir.is_dir() {
@ -353,9 +353,9 @@ pub fn scan_symlinks(sh: &Shell, reuse: &Path, fix_it: bool) -> Result<()> {
#[derive(Debug, clap::Parser)]
pub struct ReuseComplianceCheck {
#[clap(long, action)]
#[arg(long, action)]
fix_symlinks: bool,
#[clap(long, action)]
#[arg(long, action)]
download_missing_licenses: bool,
}