command: Rename introspect
to eval
This commit is contained in:
parent
f7eb121260
commit
86eeeece3c
4 changed files with 24 additions and 8 deletions
|
@ -170,7 +170,7 @@ Here is a short example:
|
||||||
The full set of options can be found at `src/nix/eval.nix`.
|
The full set of options can be found at `src/nix/eval.nix`.
|
||||||
Run `colmena build` in the same directory to build the configuration, or do `colmena apply` to build and deploy it to all nodes.
|
Run `colmena build` in the same directory to build the configuration, or do `colmena apply` to build and deploy it to all nodes.
|
||||||
|
|
||||||
## `colmena introspect`
|
## `colmena eval`
|
||||||
|
|
||||||
Sometimes you may want to extract values from your Hive configuration for consumption in another program (e.g., [OctoDNS](https://github.com/octodns/octodns)).
|
Sometimes you may want to extract values from your Hive configuration for consumption in another program (e.g., [OctoDNS](https://github.com/octodns/octodns)).
|
||||||
To do that, create a `.nix` file with a lambda:
|
To do that, create a `.nix` file with a lambda:
|
||||||
|
@ -184,7 +184,7 @@ lib.attrsets.mapAttrs (k: v: v.config.deployment.targetHost) nodes
|
||||||
Then you can evaluate with:
|
Then you can evaluate with:
|
||||||
|
|
||||||
```
|
```
|
||||||
colmena introspect your-lambda.nix
|
colmena eval your-lambda.nix
|
||||||
```
|
```
|
||||||
|
|
||||||
## `colmena apply-local`
|
## `colmena apply-local`
|
||||||
|
|
10
src/cli.rs
10
src/cli.rs
|
@ -65,12 +65,15 @@ For a sample configuration, see <https://github.com/zhaofengli/colmena>.
|
||||||
.index(1)
|
.index(1)
|
||||||
.required(true)
|
.required(true)
|
||||||
.takes_value(true)));
|
.takes_value(true)));
|
||||||
|
|
||||||
|
// deprecated alias
|
||||||
|
app = app.subcommand(command::eval::deprecated_alias());
|
||||||
}
|
}
|
||||||
|
|
||||||
register_command!(apply, app);
|
register_command!(apply, app);
|
||||||
register_command!(apply_local, app);
|
register_command!(apply_local, app);
|
||||||
register_command!(build, app);
|
register_command!(build, app);
|
||||||
register_command!(introspect, app);
|
register_command!(eval, app);
|
||||||
register_command!(upload_keys, app);
|
register_command!(upload_keys, app);
|
||||||
register_command!(exec, app);
|
register_command!(exec, app);
|
||||||
register_command!(nix_info, app);
|
register_command!(nix_info, app);
|
||||||
|
@ -85,11 +88,14 @@ pub async fn run() {
|
||||||
handle_command!(apply, matches);
|
handle_command!(apply, matches);
|
||||||
handle_command!("apply-local", apply_local, matches);
|
handle_command!("apply-local", apply_local, matches);
|
||||||
handle_command!(build, matches);
|
handle_command!(build, matches);
|
||||||
handle_command!(introspect, matches);
|
handle_command!(eval, matches);
|
||||||
handle_command!("upload-keys", upload_keys, matches);
|
handle_command!("upload-keys", upload_keys, matches);
|
||||||
handle_command!(exec, matches);
|
handle_command!(exec, matches);
|
||||||
handle_command!("nix-info", nix_info, matches);
|
handle_command!("nix-info", nix_info, matches);
|
||||||
|
|
||||||
|
// deprecated alias
|
||||||
|
handle_command!("introspect", eval, matches);
|
||||||
|
|
||||||
if let Some(args) = matches.subcommand_matches("gen-completions") {
|
if let Some(args) = matches.subcommand_matches("gen-completions") {
|
||||||
return gen_completions(args);
|
return gen_completions(args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use clap::{Arg, App, SubCommand, ArgMatches};
|
use clap::{Arg, App, AppSettings, SubCommand, ArgMatches};
|
||||||
|
|
||||||
use crate::util;
|
use crate::util;
|
||||||
|
|
||||||
pub fn subcommand() -> App<'static, 'static> {
|
pub fn subcommand() -> App<'static, 'static> {
|
||||||
SubCommand::with_name("introspect")
|
SubCommand::with_name("eval")
|
||||||
.about("Evaluate expressions using the complete configuration")
|
.about("Evaluate expressions using the complete configuration")
|
||||||
.long_about(r#"Evaluate expressions using the complete configuration
|
.long_about(r#"Evaluate expressions using the complete configuration
|
||||||
|
|
||||||
|
@ -31,7 +31,17 @@ For example, to retrieve the configuration of one node, you may write something
|
||||||
.takes_value(false))
|
.takes_value(false))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn run(_global_args: &ArgMatches<'_>, local_args: &ArgMatches<'_>) {
|
pub fn deprecated_alias() -> App<'static, 'static> {
|
||||||
|
subcommand()
|
||||||
|
.name("introspect")
|
||||||
|
.setting(AppSettings::Hidden)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn run(global_args: &ArgMatches<'_>, local_args: &ArgMatches<'_>) {
|
||||||
|
if let Some("introspect") = global_args.subcommand_name() {
|
||||||
|
log::warn!("`colmena introspect` has been renamed to `colmena eval`. Please update your scripts.");
|
||||||
|
}
|
||||||
|
|
||||||
let hive = util::hive_from_args(local_args).await.unwrap();
|
let hive = util::hive_from_args(local_args).await.unwrap();
|
||||||
|
|
||||||
if !(local_args.is_present("expression") ^ local_args.is_present("expression_file")) {
|
if !(local_args.is_present("expression") ^ local_args.is_present("expression_file")) {
|
|
@ -1,6 +1,6 @@
|
||||||
pub mod build;
|
pub mod build;
|
||||||
pub mod apply;
|
pub mod apply;
|
||||||
pub mod introspect;
|
pub mod eval;
|
||||||
pub mod apply_local;
|
pub mod apply_local;
|
||||||
pub mod upload_keys;
|
pub mod upload_keys;
|
||||||
pub mod exec;
|
pub mod exec;
|
||||||
|
|
Loading…
Reference in a new issue