File tree Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -20,26 +20,26 @@ pub enum Commands {
2020 RunCustom {
2121 /// Testcases to run
2222 testcases : String ,
23- #[ arg( value_name = "PATH" ) ]
23+ #[ arg( short , long ) ]
2424 /// File to execute
2525 file : Option < PathBuf > ,
2626 } ,
2727 #[ command( visible_alias = "-r" ) ]
2828 Run {
29- #[ arg( value_name = "PATH" ) ]
29+ #[ arg( short , long ) ]
3030 /// File to execute with default testcases
3131 file : Option < PathBuf > ,
3232 } ,
3333 /// Submits code to LeetCode
3434 #[ command( visible_alias = "-fs" ) ]
3535 FastSubmit {
36- #[ arg( value_name = "PATH" ) ]
36+ #[ arg( short , long ) ]
3737 /// File to submit
3838 file : Option < PathBuf > ,
3939 } ,
4040 #[ command( visible_alias = "-s" ) ]
4141 Submit {
42- #[ arg( value_name = "PATH" ) ]
42+ #[ arg( short , long ) ]
4343 /// File to submit
4444 file : Option < PathBuf > ,
4545 } ,
@@ -58,9 +58,10 @@ pub enum Commands {
5858pub enum Execute {
5959 #[ command( visible_alias = "-t" ) ]
6060 Testcases {
61- #[ arg( value_name = "PATH" ) ]
61+ #[ arg( short , long ) ]
6262 /// File to run
6363 file : Option < PathBuf > ,
64+ #[ arg( short, long) ]
6465 /// Testcases to run
6566 testcases : Option < String > ,
6667 } ,
Original file line number Diff line number Diff line change @@ -63,27 +63,24 @@ fn main() -> Result<()> {
6363 println ! ( "Saved question as HTML to {}" , filename. cyan( ) ) ;
6464 open:: that ( filename) ?;
6565 }
66- Some ( Commands :: RunCustom {
67- testcases,
68- file : filename,
69- } ) => {
70- _ = execute_testcases ( filename, Some ( & testcases) , & lc) ?;
66+ Some ( Commands :: RunCustom { testcases, file } ) => {
67+ _ = execute_testcases ( file, Some ( & testcases) , & lc) ?;
7168 // bail if `is_correct == false`?
7269 }
7370 Some ( Commands :: Run { file } ) => {
7471 _ = execute_testcases ( file, None , & lc) ?;
7572 }
76- Some ( Commands :: FastSubmit { file : filename } ) => {
77- let code_file = if let Some ( path) = filename {
73+ Some ( Commands :: FastSubmit { file } ) => {
74+ let code_file = if let Some ( path) = file {
7875 CodeFile :: from_file ( & path) ?
7976 } else {
8077 CodeFile :: from_dir ( "." ) ?
8178 } ;
8279
8380 submit ( & lc, code_file) ?;
8481 }
85- Some ( Commands :: Submit { file : filename } ) => {
86- let ( is_correct, code_file) = execute_testcases ( filename , None , & lc) ?;
82+ Some ( Commands :: Submit { file } ) => {
83+ let ( is_correct, code_file) = execute_testcases ( file , None , & lc) ?;
8784 if is_correct {
8885 submit ( & lc, code_file) ?;
8986 } else {
You can’t perform that action at this time.
0 commit comments