Skip to main content

radicle_cli/commands/config/
args.rs

1use clap::{Parser, Subcommand};
2use radicle::node::Alias;
3
4const ABOUT: &str = "Manage your local Radicle configuration";
5
6const LONG_ABOUT: &str = r#"
7If no argument is specified, prints the current Radicle configuration as JSON.
8To initialize a new configuration file, use `rad config init`.
9"#;
10
11#[derive(Debug, Parser)]
12#[command(about = ABOUT, long_about = LONG_ABOUT, disable_version_flag = true)]
13pub struct Args {
14    #[command(subcommand)]
15    pub(crate) command: Option<Command>,
16}
17
18#[derive(Subcommand, Debug)]
19#[group(multiple = false)]
20pub(crate) enum Command {
21    /// Show the current Radicle configuration as JSON (default)
22    Show,
23    /// Initialize a new config file
24    Init {
25        /// Alias to use for the new configuration
26        #[arg(long)]
27        alias: Alias,
28    },
29    /// Open the config in your editor
30    Edit,
31    /// Get a value from the current configuration
32    // Command is obsolete.
33    #[command(hide = true)]
34    Get {
35        /// The JSON key path to the value you want to get
36        key: String,
37    },
38    /// Prints the JSON Schema of the Radicle configuration
39    Schema,
40    /// Set a key to a value in the current configuration
41    // Command is obsolete.
42    #[command(hide = true)]
43    Set {
44        /// The JSON key path to the value you want to set
45        key: String,
46        /// The JSON value used to set the field
47        value: String,
48    },
49    /// Set a key in the current configuration to `null`
50    // Command is obsolete.
51    #[command(hide = true)]
52    Unset {
53        /// The JSON key path to the value you want to unset
54        key: String,
55    },
56    /// Push a value onto an array, which is identified by the key, in the
57    /// current configuration
58    // Command is obsolete.
59    #[command(hide = true)]
60    Push {
61        /// The JSON key path to the array you want to push to
62        key: String,
63        /// The JSON value being pushed onto the array
64        value: String,
65    },
66    /// Remove a value from an array, which is identified by the key, in the
67    /// current configuration
68    ///
69    /// All instances of the value in the array will be removed
70    // Command is obsolete.
71    #[command(hide = true)]
72    Remove {
73        /// The JSON key path to the array you want to push to
74        key: String,
75        /// The JSON value being pushed onto the array
76        value: String,
77    },
78}