diff --git a/cargotool.logo.txt b/cargotool.logo.txt new file mode 100644 index 0000000..7449163 --- /dev/null +++ b/cargotool.logo.txt @@ -0,0 +1,16 @@ +{color1} {color2} ,----, {colore} +{color1} {color2} ,/ .`| {colore} +{color1} ,----.. {color2} ,` .' : ,--, {colore} +{color1} / / \ {color2} ; ; / ,--.'| {colore} +{color1}| : : __ ,-. ,---. {color2} .'___,/ ,' ,---. ,---. | | : {colore} +{color1}. | ;. / ,' ,'/ /| ,----._,. ' ,'\ {color2} | : | ' ,'\ ' ,'\ : : ' {colore} +{color1}. ; /--` ,--.--. ' | |' | / / ' / / / |{color2} ; |.'; ; / / | / / || ' | {colore} +{color1}; | ; / \ | | ,'| : |. ; ,. :{color2} `----' | |. ; ,. :. ; ,. :' | | {colore} +{color1}| : | .--. .-. |' : / | | .\ .' | |: :{color2} ' : ;' | |: :' | |: :| | : {colore} +{color1}. | '___ \__\/: . .| | ' . ; '; |' | .; :{color2} | | '' | .; :' | .; :' : |__ {colore} +{color1}' ; : .'| ," .--.; |; : | ' . . || : |{color2} ' : || : || : || | '.'|{colore} +{color1}' | '/ :/ / ,. || , ; `---`-'| | \ \ / {color2} ; |.' \ \ / \ \ / ; : ;{colore} +{color1}| : /; : .' \---' .'__/\_: | `----' {color2} '---' `----' `----' | , / {colore} +{color1} \ \ .' | , .-./ | : : {color2} ---`-' {colore} +{color1} `---` `--`---' \ \ / {color2} {colore} +{color1} `--`-' {color2} {colore} \ No newline at end of file diff --git a/src/cmd_default.rs b/src/cmd_default.rs index 33ac253..a8e3664 100644 --- a/src/cmd_default.rs +++ b/src/cmd_default.rs @@ -1,4 +1,4 @@ -use clap::{App, Arg, ArgMatches}; +use clap::{App, ArgMatches}; use crate::cmd::CommandError; pub struct CommandImpl; @@ -6,14 +6,20 @@ pub struct CommandImpl; impl CommandImpl { pub fn process_command<'a>(app: App<'a, 'a>) -> App<'a, 'a> { - app.arg(Arg::with_name("verbose").long("verbose").short("v").multiple(true).help("Show verbose info")) + // app.arg(Arg::with_name("verbose").long("verbose").short("v").multiple(true).help("Show verbose info")) + app } - pub fn run(arg_matches: &ArgMatches) -> CommandError { - let verbose_count = arg_matches.occurrences_of("verbose"); - information!("Verbose count: {}", verbose_count); - information!("This is default command cli ..."); - // TODO ... + pub fn run(_arg_matches: &ArgMatches) -> CommandError { + let logo = include_str!("../cargotool.logo.txt"); + println!("{}", logo + .replace("{color1}", "\x1B[1m\x1B[91m") + .replace("{colore}", "\x1B[0m") + .replace("{color2}", "\x1B[32m") + ); + information!("{} v{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); + information!("Please use `{} --help` to see help message", env!("CARGO_PKG_NAME")); + println!(); Ok(()) } } \ No newline at end of file diff --git a/src/cmd_test.rs b/src/cmd_sample.rs similarity index 73% rename from src/cmd_test.rs rename to src/cmd_sample.rs index 51e5979..10d6282 100644 --- a/src/cmd_test.rs +++ b/src/cmd_sample.rs @@ -5,10 +5,10 @@ pub struct CommandImpl; impl Command for CommandImpl { - fn name(&self) -> &str { "test" } + fn name(&self) -> &str { "sample" } fn subcommand<'a>(&self) -> App<'a, 'a> { - SubCommand::with_name(self.name()).about("Test subcommand") + SubCommand::with_name(self.name()).about("Sample subcommand") } fn run(&self, _arg_matches: &ArgMatches, _sub_arg_matches: &ArgMatches) -> CommandError { diff --git a/src/main.rs b/src/main.rs index e30bbc0..c4cd85d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,14 +3,14 @@ mod cmd; mod cmd_default; mod cmd_crate; -mod cmd_test; +mod cmd_sample; use clap::App; use cmd::{Command, CommandError}; fn main() -> CommandError { let commands: Vec> = vec![ - Box::new(cmd_test::CommandImpl), + Box::new(cmd_sample::CommandImpl), Box::new(cmd_crate::CommandImpl), ]; let mut app = App::new(env!("CARGO_PKG_NAME"))