File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change 1+ use std:: path:: PathBuf ;
2+
13use clap:: { Parser , Subcommand } ;
24
35#[ derive( Parser ) ]
@@ -18,24 +20,28 @@ pub enum Commands {
1820 RunCustom {
1921 /// Testcases to run
2022 testcases : String ,
23+ #[ arg( value_name = "PATH" ) ]
2124 /// File to execute
22- filename : Option < String > ,
25+ file : Option < PathBuf > ,
2326 } ,
2427 #[ command( visible_alias = "-r" ) ]
2528 Run {
29+ #[ arg( value_name = "PATH" ) ]
2630 /// File to execute with default testcases
27- filename : Option < String > ,
31+ file : Option < PathBuf > ,
2832 } ,
2933 /// Submits code to LeetCode
3034 #[ command( visible_alias = "-fs" ) ]
3135 FastSubmit {
36+ #[ arg( value_name = "PATH" ) ]
3237 /// File to submit
33- filename : Option < String > ,
38+ file : Option < PathBuf > ,
3439 } ,
3540 #[ command( visible_alias = "-s" ) ]
3641 Submit {
42+ #[ arg( value_name = "PATH" ) ]
3743 /// File to submit
38- filename : Option < String > ,
44+ file : Option < PathBuf > ,
3945 } ,
4046 /// Save a question as HTML
4147 #[ command( visible_alias = "-q" ) ]
@@ -52,8 +58,9 @@ pub enum Commands {
5258pub enum Execute {
5359 #[ command( visible_alias = "-t" ) ]
5460 Testcases {
61+ #[ arg( value_name = "PATH" ) ]
5562 /// File to run
56- filename : Option < String > ,
63+ file : Option < PathBuf > ,
5764 /// Testcases to run
5865 testcases : Option < String > ,
5966 } ,
Original file line number Diff line number Diff line change @@ -65,15 +65,15 @@ fn main() -> Result<()> {
6565 }
6666 Some ( Commands :: RunCustom {
6767 testcases,
68- filename,
68+ file : filename,
6969 } ) => {
7070 _ = execute_testcases ( filename, Some ( & testcases) , & lc) ?;
7171 // bail if `is_correct == false`?
7272 }
73- Some ( Commands :: Run { filename } ) => {
74- _ = execute_testcases ( filename , None , & lc) ?;
73+ Some ( Commands :: Run { file } ) => {
74+ _ = execute_testcases ( file , None , & lc) ?;
7575 }
76- Some ( Commands :: FastSubmit { filename } ) => {
76+ Some ( Commands :: FastSubmit { file : filename } ) => {
7777 let code_file = if let Some ( path) = filename {
7878 CodeFile :: from_file ( & path) ?
7979 } else {
@@ -82,7 +82,7 @@ fn main() -> Result<()> {
8282
8383 submit ( & lc, code_file) ?;
8484 }
85- Some ( Commands :: Submit { filename } ) => {
85+ Some ( Commands :: Submit { file : filename } ) => {
8686 let ( is_correct, code_file) = execute_testcases ( filename, None , & lc) ?;
8787 if is_correct {
8888 submit ( & lc, code_file) ?;
You can’t perform that action at this time.
0 commit comments