1- use std:: { env, process } ;
1+ use std:: env;
22
33use anyhow:: Result ;
44use modules:: {
5- css_class:: get_class_body, defined_classes:: get_defined_classes, linter,
6- styles_imports:: get_styles_imports,
5+ css_class:: get_class_body, defined_classes:: get_defined_classes, help :: print_help , linter,
6+ styles_imports:: get_styles_imports, version :: get_version ,
77} ;
88
99mod config;
@@ -12,31 +12,19 @@ mod parsers;
1212mod utils;
1313
1414fn main ( ) -> Result < ( ) > {
15- const COLOR_RED : & str = "\x1b [31m" ;
16- const COLOR_RESET : & str = "\u{001B} [0m" ;
17-
18- let args: Vec < String > = env:: args ( ) . collect ( ) ;
1915 if let Ok ( cwd) = std:: env:: var ( "cwd" ) {
2016 env:: set_current_dir ( cwd) ?;
2117 }
2218
19+ let args: Vec < String > = env:: args ( ) . collect ( ) ;
2320 match args. get ( 1 ) {
24- Some ( arg) if arg == "-v" => {
25- print ! ( "v{}" , env!( "CARGO_PKG_VERSION" ) ) ;
26- process:: exit ( 0 ) ;
27- }
21+ Some ( arg) if arg == "-v" => get_version ( ) ?,
2822 Some ( arg) if arg == "--lint" => linter:: lint ( ) ?,
2923 Some ( arg) if arg == "--imports" => get_styles_imports ( ) ?,
3024 Some ( arg) if arg == "--classes" => get_defined_classes ( ) ?,
3125 Some ( arg) if arg == "--class" => get_class_body ( ) ?,
32- Some ( arg) => {
33- eprintln ! (
34- "{}Error{}: Invalid argument: {}" ,
35- COLOR_RED , COLOR_RESET , arg
36- ) ;
37- process:: exit ( 1 ) ;
38- }
39- None => todo ! ( ) ,
26+ Some ( _) => print_help ( ) ,
27+ None => print_help ( ) ,
4028 } ;
4129
4230 Ok ( ( ) )
0 commit comments