origen/commands/
credentials.rs

1use super::_prelude::*;
2
3pub const BASE_CMD: &'static str = "credentials";
4
5gen_core_cmd_funcs!(
6    BASE_CMD,
7    "Set or clear user credentials",
8    { |cmd: App| { cmd.arg_required_else_help(true) } },
9    core_subcmd!("set", "Set the current user's password", {
10        |cmd: App| {
11            cmd.arg(
12                Arg::new("all")
13                    .help("Set the password for all datasets")
14                    .action(SetArgTrue)
15                    .required(false)
16                    .long("all")
17                    .short('a'),
18            )
19            .arg(
20                Arg::new("datasets")
21                    .help("Specify the dataset to set the password for")
22                    .action(AppendArgs)
23                    .required(false)
24                    .num_args(1..)
25                    .conflicts_with("all")
26                    .long("dataset")
27                    .short('d'),
28            )
29        }
30    }),
31    core_subcmd!("clear", "Clear the user's password", {
32        |cmd: App| {
33            cmd.arg(
34                Arg::new("all")
35                    .help("Clear the password for all datasets")
36                    .action(SetArgTrue)
37                    .required(false)
38                    .long("all")
39                    .short('a'),
40            )
41            .arg(
42                Arg::new("datasets")
43                    .help("Specify the dataset to clear the password for")
44                    .action(AppendArgs)
45                    .required(false)
46                    .conflicts_with("all")
47                    .num_args(1..)
48                    .long("datasets")
49                    .short('d'),
50            )
51        }
52    })
53);
54
55gen_simple_run_func!();