Skip to content

Commit 18250d6

Browse files
committed
Improve --help
1 parent 3995d83 commit 18250d6

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

src/cli/arguments.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,25 @@ pub enum Line {
2828
Delete {
2929
line_number: LineNumber,
3030

31-
/// Week number
31+
/// Week number (defaults to current week if omitted)
3232
#[arg(long, short)]
3333
week: Option<u8>,
3434

35-
/// Year
35+
/// Year (defaults to current year if omitted)
3636
#[arg(long, short, requires = "week")]
3737
year: Option<i32>,
38-
3938
},
4039
}
4140

4241
#[derive(Debug, Subcommand)]
4342
pub enum Command {
4443
/// Get the time sheet for the current week
4544
Get {
46-
/// Week number
45+
/// Week number (defaults to current week if omitted)
4746
#[arg(long, short)]
4847
week: Option<u8>,
4948

50-
/// Year
49+
/// Year (defaults to current year if omitted)
5150
#[arg(long, short, requires = "week")]
5251
year: Option<i32>,
5352

@@ -62,14 +61,6 @@ pub enum Command {
6261
/// Number of hours to set
6362
hours: f32,
6463

65-
/// Week number
66-
#[arg(long, short)]
67-
week: Option<u8>,
68-
69-
/// Year
70-
#[arg(long, short, requires = "week")]
71-
year: Option<i32>,
72-
7364
/// Name of the job
7465
#[arg(long, short)]
7566
job: String,
@@ -88,6 +79,14 @@ pub enum Command {
8879
/// Also accepts short day names like "mon", "tue", etc.
8980
#[arg(long, short, value_parser = parse_days_of_week)]
9081
day: Option<Days>,
82+
83+
/// Week number (defaults to current week if omitted)
84+
#[arg(long, short)]
85+
week: Option<u8>,
86+
87+
/// Year (defaults to current year if omitted)
88+
#[arg(long, short, requires = "week")]
89+
year: Option<i32>,
9190
},
9291

9392
/// Remove hours hours on day(s) for a given job and task
@@ -111,14 +110,13 @@ pub enum Command {
111110
#[arg(long, short, value_parser = parse_days_of_week)]
112111
day: Option<Days>,
113112

114-
/// Week number
113+
/// Week number (defaults to current week if omitted)
115114
#[arg(long, short)]
116115
week: Option<u8>,
117116

118-
/// Year
117+
/// Year (defaults to current year if omitted)
119118
#[arg(long, short, requires = "week")]
120119
year: Option<i32>,
121-
122120
},
123121

124122
/// Submit time sheet for week

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,22 @@ async fn main() -> anyhow::Result<()> {
4848
Command::Get { week, year, format } => command_client.get(week, year, format).await,
4949
Command::Set {
5050
hours,
51+
job,
52+
task,
5153
day,
5254
week,
5355
year,
54-
job,
55-
task,
5656
} => {
5757
command_client
5858
.set(hours, day, week, year, &job, &task)
5959
.await
6060
}
6161
Command::Clear {
62+
job,
63+
task,
6264
day,
6365
week,
6466
year,
65-
job,
66-
task,
6767
} => command_client.clear(&job, &task, day, week, year).await,
6868
// TODO: haven't actually tested this yet (can only be tested once a week)
6969
Command::Submit => command_client.submit().await,

0 commit comments

Comments
 (0)