File tree 3 files changed +30
-0
lines changed
3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ pub mod init;
1
2
pub mod version;
Original file line number Diff line number Diff line change
1
+ use std:: { env:: current_dir, path:: Path , result:: Result } ;
2
+
3
+ const DEFAULT_CONFIG_FILE : & ' static str = ".gazer.toml" ;
4
+
5
+ pub fn run ( ) -> Result < ( ) , & ' static str > {
6
+ // TODO: Right way?
7
+ let target = current_dir ( )
8
+ . expect ( "Failed current directory" )
9
+ . join ( Path :: new ( DEFAULT_CONFIG_FILE ) ) ;
10
+
11
+ {
12
+ // TODO: Right way?
13
+ let target = target. as_os_str ( ) . to_str ( ) . expect ( "Failure" ) ;
14
+ println ! ( "{target}" ) ;
15
+ }
16
+
17
+ if target. exists ( ) {
18
+ println ! ( "Config file is already exists." ) ;
19
+ } else {
20
+ // Generate config file.
21
+ }
22
+
23
+ Ok ( ( ) )
24
+ }
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ struct Cli {
15
15
enum Commands {
16
16
/// Display version information
17
17
Version { } ,
18
+ /// Create configuration file.
19
+ Init { } ,
18
20
}
19
21
20
22
fn main ( ) {
@@ -23,6 +25,9 @@ fn main() {
23
25
Some ( Commands :: Version { } ) => {
24
26
commands:: version:: run ( ) ;
25
27
}
28
+ Some ( Commands :: Init { } ) => {
29
+ commands:: init:: run ( ) . expect ( "Command is failed" ) ;
30
+ }
26
31
None => { }
27
32
}
28
33
}
You can’t perform that action at this time.
0 commit comments