| 1 |
//! Command-line parser for `sq config template`. |
| 2 |
|
| 3 |
use clap::Args; |
| 4 |
|
| 5 |
use crate::cli::{ |
| 6 |
examples::*, |
| 7 |
types::{ClapData, FileOrStdout}, |
| 8 |
}; |
| 9 |
|
| 10 |
#[derive(Debug, Args)] |
| 11 |
#[clap( |
| 12 |
name = "template", |
| 13 |
about = "Write a template configuration file", |
| 14 |
long_about = "\ |
| 15 |
Write a template configuration file |
| 16 |
|
| 17 |
Writes a template containing the default values to the given file or stdout. \ |
| 18 |
This can be used as a starting point to tweak the configuration.", |
| 19 |
after_help = TEMPLATE_EXAMPLES, |
| 20 |
)] |
| 21 |
pub struct Command { |
| 22 |
#[clap( |
| 23 |
long, |
| 24 |
value_name = FileOrStdout::VALUE_NAME, |
| 25 |
default_value_t = FileOrStdout::default(), |
| 26 |
help = FileOrStdout::HELP_OPTIONAL, |
| 27 |
)] |
| 28 |
pub output: FileOrStdout, |
| 29 |
} |
| 30 |
|
| 31 |
const TEMPLATE_EXAMPLES: Actions = Actions { |
| 32 |
actions: &[ |
| 33 |
Action::Example(Example { |
| 34 |
comment: "\ |
| 35 |
Write a template configuration.", |
| 36 |
command: &[ |
| 37 |
"sq", "config", "template", |
| 38 |
], |
| 39 |
hide: &[], |
| 40 |
}), |
| 41 |
] |
| 42 |
}; |
| 43 |
test_examples!(sq_config_template, TEMPLATE_EXAMPLES); |