Skip to content

Commit d315c17

Browse files
authored
Short aliases and negated switches (#25)
implement short aliases and negated switches (#25)
1 parent 44c5407 commit d315c17

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/opts.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ pub struct Opts {
2222
#[clap(long)]
2323
pub host: Option<Url>,
2424

25-
#[clap(long, value_enum, default_value = "plaintext")]
25+
#[clap(long, short = 'f', value_enum, default_value = "plaintext")]
2626
pub format: PasteFormat,
2727

2828
#[cfg_attr(feature = "uniffi", uniffi(default = "1week"))]
29-
#[clap(long, default_value = "1week")]
29+
#[clap(long, short = 'e', default_value = "1week")]
3030
pub expire: String,
3131

3232
#[cfg_attr(feature = "uniffi", uniffi(default = None))]
@@ -41,13 +41,23 @@ pub struct Opts {
4141
#[clap(long, help("richer output: for delete_url, comments, etc"))]
4242
pub json: bool,
4343
#[cfg_attr(feature = "uniffi", uniffi(default = false))]
44-
#[clap(long, conflicts_with = "discussion")]
44+
#[clap(long, short = 'b', conflicts_with = "discussion")]
45+
#[clap(overrides_with = "no_burn")]
4546
#[clap(help("enable burn on read for new paste"))]
4647
pub burn: bool,
4748
#[cfg_attr(feature = "uniffi", uniffi(default = false))]
48-
#[clap(long)]
49+
#[clap(long, short = 'B')]
50+
#[clap(help("disable burn if set"))]
51+
pub no_burn: bool,
52+
#[cfg_attr(feature = "uniffi", uniffi(default = false))]
53+
#[clap(long, short = 'd')]
54+
#[clap(overrides_with = "no_discussion")]
4955
#[clap(help("enable discussion for new paste"))]
5056
pub discussion: bool,
57+
#[cfg_attr(feature = "uniffi", uniffi(default = false))]
58+
#[clap(long, short = 'D')]
59+
#[clap(help("disable burn if set"))]
60+
pub no_discussion: bool,
5161

5262
#[cfg_attr(feature = "uniffi", uniffi(default = false))]
5363
#[clap(long, requires("url"))]
@@ -63,19 +73,19 @@ pub struct Opts {
6373
pub comment_to: Option<String>,
6474

6575
#[cfg_attr(feature = "uniffi", uniffi(default = None))]
66-
#[clap(long, value_name = "FILE")]
76+
#[clap(long, short = 'o', value_name = "FILE")]
6777
pub download: Option<std::path::PathBuf>,
6878
#[cfg_attr(feature = "uniffi", uniffi(default = false))]
69-
#[clap(long)]
79+
#[clap(long, short = 'w')]
7080
#[clap(help("overwrite the file given with --download if it already exists"))]
7181
pub overwrite: bool,
7282

7383
#[cfg_attr(feature = "uniffi", uniffi(default = None))]
74-
#[clap(long, value_name = "FILE")]
84+
#[clap(long, short = 'u', value_name = "FILE")]
7585
pub upload: Option<std::path::PathBuf>,
7686

7787
#[cfg_attr(feature = "uniffi", uniffi(default = None))]
78-
#[clap(long)]
88+
#[clap(long, short = 'p')]
7989
pub password: Option<String>,
8090

8191
#[cfg_attr(feature = "uniffi", uniffi(default = None))]

0 commit comments

Comments
 (0)