diff options
Diffstat (limited to 'src/cli.rs')
-rw-r--r-- | src/cli.rs | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -1,5 +1,9 @@ | |||
1 | use crate::config::Config; | ||
2 | |||
1 | use structopt::StructOpt; | 3 | use structopt::StructOpt; |
2 | 4 | ||
5 | use std::path::PathBuf; | ||
6 | |||
3 | #[derive(Debug, Clone, StructOpt)] | 7 | #[derive(Debug, Clone, StructOpt)] |
4 | pub(crate) struct Cli { | 8 | pub(crate) struct Cli { |
5 | #[structopt(long, short, parse(from_occurrences))] | 9 | #[structopt(long, short, parse(from_occurrences))] |
@@ -8,11 +12,27 @@ pub(crate) struct Cli { | |||
8 | #[structopt(long, number_of_values = 1, parse(try_from_str = shell_words::split))] | 12 | #[structopt(long, number_of_values = 1, parse(try_from_str = shell_words::split))] |
9 | pub(crate) extra_arg: Vec<Vec<String>>, | 13 | pub(crate) extra_arg: Vec<Vec<String>>, |
10 | 14 | ||
15 | #[structopt(long, short = "C", default_value = ".")] | ||
16 | pub(crate) directory: PathBuf, | ||
17 | |||
11 | #[structopt(subcommand)] | 18 | #[structopt(subcommand)] |
12 | pub(crate) command: Command, | 19 | pub(crate) command: Command, |
20 | |||
21 | #[structopt(flatten)] | ||
22 | pub(crate) common_options: Config, | ||
13 | } | 23 | } |
14 | 24 | ||
15 | #[derive(Debug, Clone, StructOpt)] | 25 | #[derive(Debug, Clone, StructOpt)] |
16 | pub(crate) enum Command { | 26 | pub(crate) enum Command { |
17 | Generate { file: String }, | 27 | Generate { file: String }, |
28 | Config { | ||
29 | #[structopt(subcommand)] | ||
30 | command: ConfigCommand, | ||
31 | } | ||
32 | } | ||
33 | |||
34 | #[derive(Debug, Clone, StructOpt)] | ||
35 | pub(crate) enum ConfigCommand { | ||
36 | Default, | ||
37 | Show, | ||
18 | } | 38 | } |