aboutsummaryrefslogtreecommitdiff
path: root/bin/src
diff options
context:
space:
mode:
Diffstat (limited to 'bin/src')
-rw-r--r--bin/src/config.rs14
-rw-r--r--bin/src/lib.rs7
-rw-r--r--bin/src/main.rs18
3 files changed, 20 insertions, 19 deletions
diff --git a/bin/src/config.rs b/bin/src/config.rs
index 25c2a7f..d3944ac 100644
--- a/bin/src/config.rs
+++ b/bin/src/config.rs
@@ -2,17 +2,17 @@ use std::{default::Default, fmt, fs, path::PathBuf, str::FromStr};
2 2
3use crate::{dirs, err::ConfigErr}; 3use crate::{dirs, err::ConfigErr};
4 4
5use clap::Clap; 5use clap::Parser;
6use vfs::ReadOnlyVfs; 6use vfs::ReadOnlyVfs;
7 7
8#[derive(Clap, Debug)] 8#[derive(Parser, Debug)]
9#[clap(version, author, about)] 9#[clap(version, author, about)]
10pub struct Opts { 10pub struct Opts {
11 #[clap(subcommand)] 11 #[clap(subcommand)]
12 pub cmd: SubCommand, 12 pub cmd: SubCommand,
13} 13}
14 14
15#[derive(Clap, Debug)] 15#[derive(Parser, Debug)]
16pub enum SubCommand { 16pub enum SubCommand {
17 /// Lints and suggestions for the nix programming language 17 /// Lints and suggestions for the nix programming language
18 Check(Check), 18 Check(Check),
@@ -24,7 +24,7 @@ pub enum SubCommand {
24 Explain(Explain), 24 Explain(Explain),
25} 25}
26 26
27#[derive(Clap, Debug)] 27#[derive(Parser, Debug)]
28pub struct Check { 28pub struct Check {
29 /// File or directory to run check on 29 /// File or directory to run check on
30 #[clap(default_value = ".", parse(from_os_str))] 30 #[clap(default_value = ".", parse(from_os_str))]
@@ -67,7 +67,7 @@ impl Check {
67 } 67 }
68} 68}
69 69
70#[derive(Clap, Debug)] 70#[derive(Parser, Debug)]
71pub struct Fix { 71pub struct Fix {
72 /// File or directory to run fix on 72 /// File or directory to run fix on
73 #[clap(default_value = ".", parse(from_os_str))] 73 #[clap(default_value = ".", parse(from_os_str))]
@@ -127,7 +127,7 @@ impl Fix {
127 } 127 }
128} 128}
129 129
130#[derive(Clap, Debug)] 130#[derive(Parser, Debug)]
131pub struct Single { 131pub struct Single {
132 /// File to run single-fix on 132 /// File to run single-fix on
133 #[clap(parse(from_os_str))] 133 #[clap(parse(from_os_str))]
@@ -174,7 +174,7 @@ impl Single {
174 } 174 }
175} 175}
176 176
177#[derive(Clap, Debug)] 177#[derive(Parser, Debug)]
178pub struct Explain { 178pub struct Explain {
179 /// Warning code to explain 179 /// Warning code to explain
180 #[clap(parse(try_from_str = parse_warning_code))] 180 #[clap(parse(try_from_str = parse_warning_code))]
diff --git a/bin/src/lib.rs b/bin/src/lib.rs
new file mode 100644
index 0000000..49c1a41
--- /dev/null
+++ b/bin/src/lib.rs
@@ -0,0 +1,7 @@
1pub mod config;
2pub mod dirs;
3pub mod err;
4pub mod explain;
5pub mod fix;
6pub mod lint;
7pub mod traits;
diff --git a/bin/src/main.rs b/bin/src/main.rs
index fabc509..f504796 100644
--- a/bin/src/main.rs
+++ b/bin/src/main.rs
@@ -1,15 +1,9 @@
1mod config; 1use clap::Parser;
2mod dirs; 2use statix::{
3mod err; 3 config::{Opts, SubCommand},
4mod explain; 4 err::StatixErr,
5mod fix; 5 explain, fix, lint,
6mod lint; 6};
7mod traits;
8
9use crate::err::StatixErr;
10
11use clap::Clap;
12use config::{Opts, SubCommand};
13 7
14fn _main() -> Result<(), StatixErr> { 8fn _main() -> Result<(), StatixErr> {
15 let opts = Opts::parse(); 9 let opts = Opts::parse();