diff options
author | Akshay <[email protected]> | 2021-11-03 09:18:35 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2021-11-08 05:03:13 +0000 |
commit | 4e063b2abc402ac4d6902647e821978269025c7d (patch) | |
tree | a8935a5432fe86d0e5facb9ff8acc71edcb7f782 /bin/src | |
parent | 78decf580d22fa792c19c40ace39762fb027067c (diff) |
add snapshot test suitesnapshot-tests
Diffstat (limited to 'bin/src')
-rw-r--r-- | bin/src/config.rs | 14 | ||||
-rw-r--r-- | bin/src/lib.rs | 7 | ||||
-rw-r--r-- | bin/src/main.rs | 18 |
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 | ||
3 | use crate::{dirs, err::ConfigErr}; | 3 | use crate::{dirs, err::ConfigErr}; |
4 | 4 | ||
5 | use clap::Clap; | 5 | use clap::Parser; |
6 | use vfs::ReadOnlyVfs; | 6 | use vfs::ReadOnlyVfs; |
7 | 7 | ||
8 | #[derive(Clap, Debug)] | 8 | #[derive(Parser, Debug)] |
9 | #[clap(version, author, about)] | 9 | #[clap(version, author, about)] |
10 | pub struct Opts { | 10 | pub 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)] |
16 | pub enum SubCommand { | 16 | pub 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)] |
28 | pub struct Check { | 28 | pub 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)] |
71 | pub struct Fix { | 71 | pub 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)] |
131 | pub struct Single { | 131 | pub 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)] |
178 | pub struct Explain { | 178 | pub 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 @@ | |||
1 | pub mod config; | ||
2 | pub mod dirs; | ||
3 | pub mod err; | ||
4 | pub mod explain; | ||
5 | pub mod fix; | ||
6 | pub mod lint; | ||
7 | pub 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 @@ | |||
1 | mod config; | 1 | use clap::Parser; |
2 | mod dirs; | 2 | use statix::{ |
3 | mod err; | 3 | config::{Opts, SubCommand}, |
4 | mod explain; | 4 | err::StatixErr, |
5 | mod fix; | 5 | explain, fix, lint, |
6 | mod lint; | 6 | }; |
7 | mod traits; | ||
8 | |||
9 | use crate::err::StatixErr; | ||
10 | |||
11 | use clap::Clap; | ||
12 | use config::{Opts, SubCommand}; | ||
13 | 7 | ||
14 | fn _main() -> Result<(), StatixErr> { | 8 | fn _main() -> Result<(), StatixErr> { |
15 | let opts = Opts::parse(); | 9 | let opts = Opts::parse(); |