File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ pub fn write_readme(r: &mut Vec<Resp>) {
2121
2222 match std:: fs:: write ( "README.md" , s) {
2323 Ok ( _) => ( ) ,
24- Err ( e) => println ! ( "写入 README.md 失败,err{}" , e. to_string( ) )
24+ Err ( e) => eprintln ! ( "写入 README.md 失败,err{}" , e. to_string( ) )
2525 }
2626}
2727
@@ -41,7 +41,7 @@ pub fn get_all_bin_file() -> Vec<String> {
4141pub fn write_question ( resp : Resp ) {
4242 let file = format ! ( "src/bin/{}.rs" , resp. data. question. title_slug) ;
4343 if std:: path:: Path :: new ( file. as_str ( ) ) . exists ( ) {
44- println ! ( "{} exists" , file) ;
44+ eprintln ! ( "{} exists" , file) ;
4545 return ;
4646 }
4747
Original file line number Diff line number Diff line change 77
88use clap:: { App , Arg } ;
99
10+ use std:: process;
11+
1012pub fn run ( ) {
1113 let matches = App :: new ( "leetcode" )
1214 . version ( "0.0.1" )
@@ -24,7 +26,10 @@ pub fn run() {
2426 if let Some ( matches) = matches. subcommand_matches ( "new" ) {
2527 match matches. value_of_t :: < String > ( "question_name" ) {
2628 Ok ( x) => new:: new ( x) ,
27- Err ( _) => println ! ( "please input the name of question" )
29+ Err ( _) => {
30+ eprintln ! ( "please input the name of question" ) ;
31+ process:: exit ( 1 ) ;
32+ }
2833 }
2934 } else if matches. subcommand_matches ( "all" ) . is_some ( ) {
3035 all:: all ( ) ;
Original file line number Diff line number Diff line change 11fn main ( ) {
2- leetcode:: run ( )
2+ leetcode:: run ( ) ;
33}
You can’t perform that action at this time.
0 commit comments