rename CLI to ta

This commit is contained in:
Dustin J. Mitchell 2021-05-01 14:07:00 -04:00
parent 73ad035bed
commit 0f0f2b0e75
13 changed files with 38 additions and 37 deletions

View file

@ -49,10 +49,10 @@ mod test {
#[test]
fn test_version() {
assert_eq!(
Command::from_argv(argv!["task", "version"]).unwrap(),
Command::from_argv(argv!["ta", "version"]).unwrap(),
Command {
subcommand: Subcommand::Version,
command_name: s!("task"),
command_name: s!("ta"),
}
);
}

View file

@ -19,12 +19,12 @@ mod test {
#[test]
fn test_summary() {
let mut w = test_writer();
execute(&mut w, s!("task"), true).unwrap();
execute(&mut w, s!("ta"), true).unwrap();
}
#[test]
fn test_long() {
let mut w = test_writer();
execute(&mut w, s!("task"), false).unwrap();
execute(&mut w, s!("ta"), false).unwrap();
}
}

View file

@ -42,7 +42,7 @@ impl Usage {
writeln!(w, "USAGE:\n {} [args]\n", command_name)?;
writeln!(w, "TaskChampion subcommands:")?;
for subcommand in self.subcommands.iter() {
subcommand.write_help(&mut w, summary)?;
subcommand.write_help(&mut w, command_name, summary)?;
}
writeln!(w, "Filter Expressions:\n")?;
writeln!(
@ -56,7 +56,7 @@ impl Usage {
)
)?;
for filter in self.filters.iter() {
filter.write_help(&mut w, summary)?;
filter.write_help(&mut w, command_name, summary)?;
}
writeln!(w, "Modifications:\n")?;
writeln!(
@ -70,10 +70,10 @@ impl Usage {
)
)?;
for modification in self.modifications.iter() {
modification.write_help(&mut w, summary)?;
modification.write_help(&mut w, command_name, summary)?;
}
if !summary {
writeln!(w, "\nSee `task help` for more detail")?;
writeln!(w, "\nSee `{} help` for more detail", command_name)?;
}
Ok(())
}
@ -108,13 +108,14 @@ pub(crate) struct Subcommand {
}
impl Subcommand {
fn write_help<W: Write>(&self, mut w: W, summary: bool) -> Result<()> {
fn write_help<W: Write>(&self, mut w: W, command_name: &str, summary: bool) -> Result<()> {
if summary {
writeln!(w, " task {} - {}", self.name, self.summary)?;
writeln!(w, " {} {} - {}", command_name, self.name, self.summary)?;
} else {
writeln!(
w,
" task {}\n{}",
" {} {}\n{}",
command_name,
self.syntax,
indented(self.description, " ")
)?;
@ -138,7 +139,7 @@ pub(crate) struct Filter {
}
impl Filter {
fn write_help<W: Write>(&self, mut w: W, summary: bool) -> Result<()> {
fn write_help<W: Write>(&self, mut w: W, _: &str, summary: bool) -> Result<()> {
if summary {
writeln!(w, " {} - {}", self.syntax, self.summary)?;
} else {
@ -168,7 +169,7 @@ pub(crate) struct Modification {
}
impl Modification {
fn write_help<W: Write>(&self, mut w: W, summary: bool) -> Result<()> {
fn write_help<W: Write>(&self, mut w: W, _: &str, summary: bool) -> Result<()> {
if summary {
writeln!(w, " {} - {}", self.syntax, self.summary)?;
} else {