diff options
| author | diogo464 <[email protected]> | 2021-10-30 20:55:22 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2021-10-30 21:07:00 +0100 |
| commit | 3b4b9aa6bc041f1e24761e94b1c052ad20f9ca66 (patch) | |
| tree | 3ddd456c76fef336bbb4148e38f5e9ac214a1bd1 | |
| parent | 35ea23dad9071078ea302e52ff7c51482e657714 (diff) | |
update to compile with new clap version
| -rw-r--r-- | dotup_cli/src/commands/init.rs | 3 | ||||
| -rw-r--r-- | dotup_cli/src/commands/install.rs | 5 | ||||
| -rw-r--r-- | dotup_cli/src/commands/link.rs | 3 | ||||
| -rw-r--r-- | dotup_cli/src/commands/uninstall.rs | 5 | ||||
| -rw-r--r-- | dotup_cli/src/commands/unlink.rs | 3 | ||||
| -rw-r--r-- | dotup_cli/src/main.rs | 9 |
6 files changed, 11 insertions, 17 deletions
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::*; | |||
| 4 | /// | 4 | /// |
| 5 | /// By default this will create the file in the current directory | 5 | /// By default this will create the file in the current directory |
| 6 | /// but the --depot flag can be used to change this path. | 6 | /// but the --depot flag can be used to change this path. |
| 7 | #[derive(Clap)] | 7 | #[derive(Parser)] |
| 8 | #[clap(setting = AppSettings::ColoredHelp)] | ||
| 9 | pub struct Opts {} | 8 | pub struct Opts {} |
| 10 | 9 | ||
| 11 | pub fn main(config: Config, opts: Opts) -> anyhow::Result<()> { | 10 | 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::*; | |||
| 6 | /// | 6 | /// |
| 7 | /// Installing a link will create the necessary directories. | 7 | /// Installing a link will create the necessary directories. |
| 8 | /// If a file or directory already exists at the location a link would be installed this command will fail. | 8 | /// If a file or directory already exists at the location a link would be installed this command will fail. |
| 9 | #[derive(Clap)] | 9 | #[derive(Parser)] |
| 10 | #[clap(setting = AppSettings::ColoredHelp)] | ||
| 11 | pub struct Opts { | 10 | pub struct Opts { |
| 12 | /// The location where links will be installed to. | 11 | /// The location where links will be installed to. |
| 13 | /// Defaults to the home directory. | 12 | /// Defaults to the home directory. |
| @@ -15,7 +14,7 @@ pub struct Opts { | |||
| 15 | install_base: Option<PathBuf>, | 14 | install_base: Option<PathBuf>, |
| 16 | 15 | ||
| 17 | /// The files/directories to install. | 16 | /// The files/directories to install. |
| 18 | #[clap(required = true, min_values = 1, default_value = ".")] | 17 | #[clap(min_values = 1, default_value = ".")] |
| 19 | paths: Vec<PathBuf>, | 18 | paths: Vec<PathBuf>, |
| 20 | } | 19 | } |
| 21 | 20 | ||
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::*; | |||
| 10 | /// If a link is created for a file that already had a link then the old link will be overwritten. | 10 | /// If a link is created for a file that already had a link then the old link will be overwritten. |
| 11 | /// By default creating a link to a directory will recursively link all files under that | 11 | /// By default creating a link to a directory will recursively link all files under that |
| 12 | /// directory, to actually link a directory use the --directory flag. | 12 | /// directory, to actually link a directory use the --directory flag. |
| 13 | #[derive(Clap)] | 13 | #[derive(Parser)] |
| 14 | #[clap(setting = AppSettings::ColoredHelp)] | ||
| 15 | pub struct Opts { | 14 | pub struct Opts { |
| 16 | /// Treats the paths as directories. This will create links to the actual directories instead | 15 | /// Treats the paths as directories. This will create links to the actual directories instead |
| 17 | /// of recursively linking all files under them. | 16 | /// 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::*; | |||
| 7 | /// Uninstalling a link for a file that didnt have a link will do nothing. | 7 | /// Uninstalling a link for a file that didnt have a link will do nothing. |
| 8 | /// Uninstalling a directory will recursively uninstall all files under it. | 8 | /// Uninstalling a directory will recursively uninstall all files under it. |
| 9 | /// Symlinks are only deleted if they were pointing to the correct file. | 9 | /// Symlinks are only deleted if they were pointing to the correct file. |
| 10 | #[derive(Clap)] | 10 | #[derive(Parser)] |
| 11 | #[clap(setting = AppSettings::ColoredHelp)] | ||
| 12 | pub struct Opts { | 11 | pub struct Opts { |
| 13 | /// The location where links will be uninstalled from. | 12 | /// The location where links will be uninstalled from. |
| 14 | /// Defaults to home directory. | 13 | /// Defaults to home directory. |
| @@ -16,7 +15,7 @@ pub struct Opts { | |||
| 16 | install_base: Option<PathBuf>, | 15 | install_base: Option<PathBuf>, |
| 17 | 16 | ||
| 18 | /// The files/directories to uninstall. | 17 | /// The files/directories to uninstall. |
| 19 | #[clap(required = true, min_values = 1, default_value = ".")] | 18 | #[clap(min_values = 1, default_value = ".")] |
| 20 | paths: Vec<PathBuf>, | 19 | paths: Vec<PathBuf>, |
| 21 | } | 20 | } |
| 22 | 21 | ||
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::*; | |||
| 10 | /// This will recursively remove links. If a path is a directory then it will remove all links | 10 | /// This will recursively remove links. If a path is a directory then it will remove all links |
| 11 | /// recursively. | 11 | /// recursively. |
| 12 | /// The links are not uninstall by default, see the --uninstall parameter. | 12 | /// The links are not uninstall by default, see the --uninstall parameter. |
| 13 | #[derive(Clap)] | 13 | #[derive(Parser)] |
| 14 | #[clap(setting = AppSettings::ColoredHelp)] | ||
| 15 | pub struct Opts { | 14 | pub struct Opts { |
| 16 | /// Specify the install base if the links are also to be uninstalled. | 15 | /// Specify the install base if the links are also to be uninstalled. |
| 17 | #[clap(long)] | 16 | #[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; | |||
| 8 | 8 | ||
| 9 | pub mod prelude { | 9 | pub mod prelude { |
| 10 | pub use super::{utils, Config}; | 10 | pub use super::{utils, Config}; |
| 11 | pub use clap::{AppSettings, Clap}; | 11 | pub use clap::{AppSettings, Parser}; |
| 12 | pub use dotup::{Archive, Depot, DepotConfig, Link, LinkCreateParams, LinkID}; | 12 | pub use dotup::{Archive, Depot, DepotConfig, Link, LinkCreateParams, LinkID}; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | use clap::{AppSettings, Clap}; | 15 | use clap::{AppSettings, Parser}; |
| 16 | use flexi_logger::Logger; | 16 | use flexi_logger::Logger; |
| 17 | use std::{ | 17 | use std::{ |
| 18 | collections::HashMap, | 18 | collections::HashMap, |
| @@ -22,8 +22,7 @@ use std::{ | |||
| 22 | 22 | ||
| 23 | use prelude::*; | 23 | use prelude::*; |
| 24 | 24 | ||
| 25 | #[derive(Clap)] | 25 | #[derive(Parser)] |
| 26 | #[clap(setting = AppSettings::ColoredHelp)] | ||
| 27 | struct Opts { | 26 | struct Opts { |
| 28 | /// Path to the depot file. | 27 | /// Path to the depot file. |
| 29 | /// | 28 | /// |
| @@ -50,7 +49,7 @@ struct Opts { | |||
| 50 | subcmd: SubCommand, | 49 | subcmd: SubCommand, |
| 51 | } | 50 | } |
| 52 | 51 | ||
| 53 | #[derive(Clap)] | 52 | #[derive(Parser)] |
| 54 | enum SubCommand { | 53 | enum SubCommand { |
| 55 | Init(commands::init::Opts), | 54 | Init(commands::init::Opts), |
| 56 | Link(commands::link::Opts), | 55 | Link(commands::link::Opts), |
