@@ -6,12 +6,14 @@ use clap::Parser;
6
6
use std:: process:: exit;
7
7
use tracing:: { debug, error} ;
8
8
use crate :: config:: { File , Directory , FileContent } ;
9
- use file_helper:: { get_file, set_file, delete_file, export_file_path, export_dir_path} ;
9
+ use file_helper:: { get_file, set_file, delete_file, export_file_path} ;
10
+ use dir_helpers:: { get_dir, set_dir, delete_dir, export_dir_path} ;
10
11
use schemars:: schema_for;
11
12
12
13
mod args;
13
14
pub mod config;
14
15
mod file_helper;
16
+ mod dir_helpers;
15
17
16
18
const EXIT_SUCCESS : i32 = 0 ;
17
19
const EXIT_INVALID_INPUT : i32 = 2 ;
@@ -31,9 +33,9 @@ fn main() {
31
33
None => {
32
34
let dir = match is_directory_type ( input. as_str ( ) ) {
33
35
Some ( dir) => {
34
- // let dir = get_file (&dir).unwrap();
35
- // let json = serde_json::to_string(&dir).unwrap();
36
- // println!("{}", json);
36
+ let dir = get_dir ( & dir) . unwrap ( ) ;
37
+ let json = serde_json:: to_string ( & dir) . unwrap ( ) ;
38
+ println ! ( "{}" , json) ;
37
39
}
38
40
None => {
39
41
let filecontent = match is_fillecontent_type ( input. as_str ( ) ) {
@@ -64,9 +66,9 @@ fn main() {
64
66
None => {
65
67
let dir = match is_directory_type ( input. as_str ( ) ) {
66
68
Some ( dir) => {
67
- // let dir = delete_file (&dir).unwrap();
68
- // let json = serde_json::to_string(&dir).unwrap();
69
- // println!("{}", json);
69
+ let dir = delete_dir ( & dir) . unwrap ( ) ;
70
+ let json = serde_json:: to_string ( & dir) . unwrap ( ) ;
71
+ println ! ( "{}" , json) ;
70
72
}
71
73
None => {
72
74
let filecontent = match is_fillecontent_type ( input. as_str ( ) ) {
@@ -98,9 +100,9 @@ fn main() {
98
100
None => {
99
101
let dir = match is_directory_type ( input. as_str ( ) ) {
100
102
Some ( dir) => {
101
- // let dir = get_file (&dir).unwrap();
102
- // let json = serde_json::to_string(&dir).unwrap();
103
- // println!("{}", json);
103
+ let dir = set_dir ( & dir) . unwrap ( ) ;
104
+ let json = serde_json:: to_string ( & dir) . unwrap ( ) ;
105
+ println ! ( "{}" , json) ;
104
106
}
105
107
None => {
106
108
let filecontent = match is_fillecontent_type ( input. as_str ( ) ) {
0 commit comments