-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathargs.rs
More file actions
79 lines (72 loc) · 2.26 KB
/
args.rs
File metadata and controls
79 lines (72 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
use clap::{Parser, Subcommand, ValueEnum};
use rust_i18n::t;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, ValueEnum)]
pub enum TraceFormat {
Default,
Plaintext,
Json,
}
#[derive(Debug, Clone, PartialEq, Eq, ValueEnum)]
pub enum TraceLevel {
Error,
Warn,
Info,
Debug,
Trace
}
#[derive(Parser)]
pub struct Args {
#[clap(subcommand)]
pub command: Command,
#[clap(short = 'l', long, help = "Trace level to use", value_enum)]
pub trace_level: Option<TraceLevel>,
#[clap(short = 'f', long, help = "Trace format to use", value_enum, default_value = "json")]
pub trace_format: TraceFormat,
}
#[derive(Subcommand)]
pub enum Command {
/// Get default shell and `sshd_config`, eventually to be used for repeatable keywords
Get {
#[clap(short = 'i', long, help = t!("args.getInput").to_string())]
input: Option<String>,
#[clap(short = 's', long, hide = true)]
setting: Setting,
},
/// Set default shell, eventually to be used for `sshd_config` and repeatable keywords
Set {
#[clap(short = 'i', long, help = t!("args.setInput").to_string())]
input: String,
#[clap(short = 's', long, hide = true)]
setting: Setting,
},
/// Export `sshd_config`, eventually to be used for repeatable keywords
Export {
#[clap(short = 'i', long, help = t!("args.exportInput").to_string())]
input: Option<String>
},
Schema {
// Used to inform which schema to generate
#[clap(short = 's', long, hide = true)]
setting: Setting,
},
}
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
pub struct DefaultShell {
#[serde(skip_serializing_if = "Option::is_none")]
pub shell: Option<String>,
#[serde(rename = "cmdOption", skip_serializing_if = "Option::is_none")]
pub cmd_option: Option<String>,
#[serde(rename = "escapeArguments", skip_serializing_if = "Option::is_none")]
pub escape_arguments: Option<bool>,
}
#[derive(Clone, Debug, Eq, PartialEq, ValueEnum)]
pub enum Setting {
SshdConfig,
SshdConfigRepeat,
SshdConfigRepeatList,
WindowsGlobal,
}