File tree 3 files changed +9
-4
lines changed
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>) {
21
21
22
22
match std:: fs:: write ( "README.md" , s) {
23
23
Ok ( _) => ( ) ,
24
- Err ( e) => println ! ( "写入 README.md 失败,err{}" , e. to_string( ) )
24
+ Err ( e) => eprintln ! ( "写入 README.md 失败,err{}" , e. to_string( ) )
25
25
}
26
26
}
27
27
@@ -41,7 +41,7 @@ pub fn get_all_bin_file() -> Vec<String> {
41
41
pub fn write_question ( resp : Resp ) {
42
42
let file = format ! ( "src/bin/{}.rs" , resp. data. question. title_slug) ;
43
43
if std:: path:: Path :: new ( file. as_str ( ) ) . exists ( ) {
44
- println ! ( "{} exists" , file) ;
44
+ eprintln ! ( "{} exists" , file) ;
45
45
return ;
46
46
}
47
47
Original file line number Diff line number Diff line change 7
7
8
8
use clap:: { App , Arg } ;
9
9
10
+ use std:: process;
11
+
10
12
pub fn run ( ) {
11
13
let matches = App :: new ( "leetcode" )
12
14
. version ( "0.0.1" )
@@ -24,7 +26,10 @@ pub fn run() {
24
26
if let Some ( matches) = matches. subcommand_matches ( "new" ) {
25
27
match matches. value_of_t :: < String > ( "question_name" ) {
26
28
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
+ }
28
33
}
29
34
} else if matches. subcommand_matches ( "all" ) . is_some ( ) {
30
35
all:: all ( ) ;
Original file line number Diff line number Diff line change 1
1
fn main ( ) {
2
- leetcode:: run ( )
2
+ leetcode:: run ( ) ;
3
3
}
You can’t perform that action at this time.
0 commit comments