Skip to content

Commit e4731c6

Browse files
committed
feat: Can use -p as shortcut when editing the project on a checkpoint
1 parent b7f168f commit e4731c6

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/main.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ fn main() {
187187
)
188188
.arg(
189189
Arg::with_name("message")
190-
.short("m")
191190
.long("message")
191+
.short("m")
192192
.help("What the checkpoint's describing message should be changed to")
193193
.takes_value(true),
194194
)
@@ -201,6 +201,7 @@ fn main() {
201201
.arg(
202202
Arg::with_name("project")
203203
.long("project")
204+
.short("p")
204205
.help("Change the checkpoint's project")
205206
.takes_value(true),
206207
)
@@ -425,14 +426,6 @@ fn print_checkpoint(matches: &clap::ArgMatches, config: &Config) -> io::Result<(
425426
"".to_string()
426427
};
427428

428-
// let project = log_checkpoint
429-
// .checkpoint
430-
// .project_id
431-
// .iter()
432-
// .map(|i| &*checkpoint_db.projects[i].short_name)
433-
// .collect::<Vec<&str>>()
434-
// .join(", ");
435-
436429
let duration = match log_checkpoint.duration {
437430
Some(d) => hour_string_from_i64(d),
438431
None => "-".to_string(),
@@ -636,13 +629,6 @@ fn log(matches: &clap::ArgMatches, config: &Config) -> io::Result<()> {
636629
.format("%H:%M")
637630
.to_string();
638631

639-
// let project_string: String = log_checkpoint
640-
// .checkpoint
641-
// .project_id
642-
// .map(|i| &*checkpoint_db.projects[i].short_name)
643-
// .collect::<Vec<&str>>()
644-
// .join(" ");
645-
646632
let project_string = if let Some(project) =
647633
checkpoint_db.project_from_project_id(log_checkpoint.checkpoint.project_id)
648634
{
@@ -788,7 +774,7 @@ fn edit_checkpoint(matches: &clap::ArgMatches, config: &Config) -> io::Result<()
788774
return Ok(());
789775
}
790776
} else {
791-
println!("Invalid project short name: [{}]", project);
777+
println!("Invalid project short name: '{}'", project);
792778
return Ok(());
793779
}
794780
}
@@ -827,7 +813,7 @@ fn add_project(matches: &clap::ArgMatches, config: &Config) -> io::Result<()> {
827813
let path = Path::new(&config.database_path);
828814
let mut checkpoint_db = time_track::CheckpointDb::read(path)?;
829815

830-
// I can unwrap these because these arguments are required in Clap.
816+
// I can unwrap these because they are required in Clap.
831817
let long_name = matches.value_of("long").unwrap();
832818
let short_name = matches.value_of("short").unwrap();
833819

0 commit comments

Comments
 (0)