rename CLI to ta
This commit is contained in:
@@ -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"),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::fs;
|
||||
use std::process::Command;
|
||||
use tempfile::TempDir;
|
||||
|
||||
// NOTE: This tests that the task binary is running and parsing arguments. The details of
|
||||
// NOTE: This tests that the `ta` binary is running and parsing arguments. The details of
|
||||
// subcommands are handled with unit tests.
|
||||
|
||||
/// These tests force config to be read via TASKCHAMPION_CONFIG so that a user's own config file
|
||||
@@ -17,7 +17,7 @@ fn test_cmd(dir: &TempDir) -> Result<Command, Box<dyn std::error::Error>> {
|
||||
)?;
|
||||
|
||||
let config_filename = config_filename.to_str().unwrap();
|
||||
let mut cmd = Command::cargo_bin("task")?;
|
||||
let mut cmd = Command::cargo_bin("ta")?;
|
||||
cmd.env("TASKCHAMPION_CONFIG", config_filename);
|
||||
Ok(cmd)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user