forked from DGNum/colmena
cli.rs: Point user at manual
This commit is contained in:
parent
1ac5fd0f9b
commit
80a71d9023
3 changed files with 16 additions and 5 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -132,6 +132,7 @@ dependencies = [
|
||||||
"glob",
|
"glob",
|
||||||
"hostname",
|
"hostname",
|
||||||
"indicatif",
|
"indicatif",
|
||||||
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"quit",
|
"quit",
|
||||||
|
|
|
@ -17,6 +17,7 @@ futures = "0.3.8"
|
||||||
glob = "0.3.0"
|
glob = "0.3.0"
|
||||||
hostname = "0.3.1"
|
hostname = "0.3.1"
|
||||||
indicatif = "0.17.0-beta.1"
|
indicatif = "0.17.0-beta.1"
|
||||||
|
lazy_static = "1.4.0"
|
||||||
libc = "0.2.81"
|
libc = "0.2.81"
|
||||||
log = "0.4.11"
|
log = "0.4.11"
|
||||||
quit = "1.1.2"
|
quit = "1.1.2"
|
||||||
|
|
19
src/cli.rs
19
src/cli.rs
|
@ -1,8 +1,19 @@
|
||||||
//! Global CLI Setup.
|
//! Global CLI Setup.
|
||||||
|
|
||||||
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
|
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
|
||||||
|
use lazy_static::lazy_static;
|
||||||
|
|
||||||
use crate::command;
|
use crate::command;
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref CONFIG_HELP: String = {
|
||||||
|
format!(r#"If this argument is not specified, Colmena will search upwards from the current working directory for a file named "flake.nix" or "hive.nix". This behavior is disabled if --config/-f is given explicitly.
|
||||||
|
|
||||||
|
For a sample configuration, see <https://zhaofengli.github.io/colmena/{}>.
|
||||||
|
"#, env!("CARGO_PKG_VERSION"))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! register_command {
|
macro_rules! register_command {
|
||||||
($module:ident, $app:ident) => {
|
($module:ident, $app:ident) => {
|
||||||
$app = $app.subcommand(command::$module::subcommand());
|
$app = $app.subcommand(command::$module::subcommand());
|
||||||
|
@ -25,9 +36,10 @@ macro_rules! handle_command {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_cli(include_internal: bool) -> App<'static, 'static> {
|
pub fn build_cli(include_internal: bool) -> App<'static, 'static> {
|
||||||
|
let version = env!("CARGO_PKG_VERSION");
|
||||||
let mut app = App::new("Colmena")
|
let mut app = App::new("Colmena")
|
||||||
.bin_name("colmena")
|
.bin_name("colmena")
|
||||||
.version("0.1.0")
|
.version(version)
|
||||||
.author("Zhaofeng Li <hello@zhaofeng.li>")
|
.author("Zhaofeng Li <hello@zhaofeng.li>")
|
||||||
.about("NixOS deployment tool")
|
.about("NixOS deployment tool")
|
||||||
.global_setting(AppSettings::ColoredHelp)
|
.global_setting(AppSettings::ColoredHelp)
|
||||||
|
@ -45,10 +57,7 @@ pub fn build_cli(include_internal: bool) -> App<'static, 'static> {
|
||||||
// or "hive.nix". This behavior is disabled if --config/-f
|
// or "hive.nix". This behavior is disabled if --config/-f
|
||||||
// is explicitly supplied by the user (occurrences_of > 0).
|
// is explicitly supplied by the user (occurrences_of > 0).
|
||||||
.default_value("hive.nix")
|
.default_value("hive.nix")
|
||||||
.long_help(r#"If this argument is not specified, Colmena will search upwards from the current working directory for a file named "flake.nix" or "hive.nix". This behavior is disabled if --config/-f is given explicitly.
|
.long_help(&CONFIG_HELP)
|
||||||
|
|
||||||
For a sample configuration, see <https://github.com/zhaofengli/colmena>.
|
|
||||||
"#)
|
|
||||||
.global(true))
|
.global(true))
|
||||||
.arg(Arg::with_name("show-trace")
|
.arg(Arg::with_name("show-trace")
|
||||||
.long("show-trace")
|
.long("show-trace")
|
||||||
|
|
Loading…
Reference in a new issue