From 3b4b9aa6bc041f1e24761e94b1c052ad20f9ca66 Mon Sep 17 00:00:00 2001 From: diogo464 Date: Sat, 30 Oct 2021 20:55:22 +0100 Subject: update to compile with new clap version --- dotup_cli/src/commands/init.rs | 3 +-- dotup_cli/src/commands/install.rs | 5 ++--- dotup_cli/src/commands/link.rs | 3 +-- dotup_cli/src/commands/uninstall.rs | 5 ++--- dotup_cli/src/commands/unlink.rs | 3 +-- dotup_cli/src/main.rs | 9 ++++----- 6 files changed, 11 insertions(+), 17 deletions(-) (limited to 'dotup_cli') diff --git a/dotup_cli/src/commands/init.rs b/dotup_cli/src/commands/init.rs index b894924..45129bf 100644 --- a/dotup_cli/src/commands/init.rs +++ b/dotup_cli/src/commands/init.rs @@ -4,8 +4,7 @@ use super::prelude::*; /// /// By default this will create the file in the current directory /// but the --depot flag can be used to change this path. -#[derive(Clap)] -#[clap(setting = AppSettings::ColoredHelp)] +#[derive(Parser)] pub struct Opts {} pub fn main(config: Config, opts: Opts) -> anyhow::Result<()> { diff --git a/dotup_cli/src/commands/install.rs b/dotup_cli/src/commands/install.rs index b56c5f7..e166a7b 100644 --- a/dotup_cli/src/commands/install.rs +++ b/dotup_cli/src/commands/install.rs @@ -6,8 +6,7 @@ use super::prelude::*; /// /// Installing a link will create the necessary directories. /// If a file or directory already exists at the location a link would be installed this command will fail. -#[derive(Clap)] -#[clap(setting = AppSettings::ColoredHelp)] +#[derive(Parser)] pub struct Opts { /// The location where links will be installed to. /// Defaults to the home directory. @@ -15,7 +14,7 @@ pub struct Opts { install_base: Option, /// The files/directories to install. - #[clap(required = true, min_values = 1, default_value = ".")] + #[clap(min_values = 1, default_value = ".")] paths: Vec, } diff --git a/dotup_cli/src/commands/link.rs b/dotup_cli/src/commands/link.rs index 66194e1..d1f61ea 100644 --- a/dotup_cli/src/commands/link.rs +++ b/dotup_cli/src/commands/link.rs @@ -10,8 +10,7 @@ use super::prelude::*; /// If a link is created for a file that already had a link then the old link will be overwritten. /// By default creating a link to a directory will recursively link all files under that /// directory, to actually link a directory use the --directory flag. -#[derive(Clap)] -#[clap(setting = AppSettings::ColoredHelp)] +#[derive(Parser)] pub struct Opts { /// Treats the paths as directories. This will create links to the actual directories instead /// of recursively linking all files under them. diff --git a/dotup_cli/src/commands/uninstall.rs b/dotup_cli/src/commands/uninstall.rs index a81d5e4..fdb1a0a 100644 --- a/dotup_cli/src/commands/uninstall.rs +++ b/dotup_cli/src/commands/uninstall.rs @@ -7,8 +7,7 @@ use super::prelude::*; /// Uninstalling a link for a file that didnt have a link will do nothing. /// Uninstalling a directory will recursively uninstall all files under it. /// Symlinks are only deleted if they were pointing to the correct file. -#[derive(Clap)] -#[clap(setting = AppSettings::ColoredHelp)] +#[derive(Parser)] pub struct Opts { /// The location where links will be uninstalled from. /// Defaults to home directory. @@ -16,7 +15,7 @@ pub struct Opts { install_base: Option, /// The files/directories to uninstall. - #[clap(required = true, min_values = 1, default_value = ".")] + #[clap(min_values = 1, default_value = ".")] paths: Vec, } diff --git a/dotup_cli/src/commands/unlink.rs b/dotup_cli/src/commands/unlink.rs index f33fe60..abe23e3 100644 --- a/dotup_cli/src/commands/unlink.rs +++ b/dotup_cli/src/commands/unlink.rs @@ -10,8 +10,7 @@ use super::prelude::*; /// This will recursively remove links. If a path is a directory then it will remove all links /// recursively. /// The links are not uninstall by default, see the --uninstall parameter. -#[derive(Clap)] -#[clap(setting = AppSettings::ColoredHelp)] +#[derive(Parser)] pub struct Opts { /// Specify the install base if the links are also to be uninstalled. #[clap(long)] diff --git a/dotup_cli/src/main.rs b/dotup_cli/src/main.rs index d500a7d..5f02e68 100644 --- a/dotup_cli/src/main.rs +++ b/dotup_cli/src/main.rs @@ -8,11 +8,11 @@ pub use config::Config; pub mod prelude { pub use super::{utils, Config}; - pub use clap::{AppSettings, Clap}; + pub use clap::{AppSettings, Parser}; pub use dotup::{Archive, Depot, DepotConfig, Link, LinkCreateParams, LinkID}; } -use clap::{AppSettings, Clap}; +use clap::{AppSettings, Parser}; use flexi_logger::Logger; use std::{ collections::HashMap, @@ -22,8 +22,7 @@ use std::{ use prelude::*; -#[derive(Clap)] -#[clap(setting = AppSettings::ColoredHelp)] +#[derive(Parser)] struct Opts { /// Path to the depot file. /// @@ -50,7 +49,7 @@ struct Opts { subcmd: SubCommand, } -#[derive(Clap)] +#[derive(Parser)] enum SubCommand { Init(commands::init::Opts), Link(commands::link::Opts), -- cgit