diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-04-26 08:07:53 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-04-26 08:09:37 +0200 |
commit | b0e90a3384208e8c5dd56a0fea2920a8ff66a67e (patch) | |
tree | a0926fdf8014bb672aadbff452c434c6aeb27dac | |
parent | 4e4bb3ce7bfb6f745be6a1738a04f38087b6b713 (diff) |
Add subcommand to fetch available plugin kind names
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r-- | tedge/src/cli.rs | 4 | ||||
-rw-r--r-- | tedge/src/main.rs | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tedge/src/cli.rs b/tedge/src/cli.rs index 27c99526..5676a779 100644 --- a/tedge/src/cli.rs +++ b/tedge/src/cli.rs @@ -24,4 +24,8 @@ pub(crate) enum CliCommand { #[clap(name = "validate-config")] ValidateConfig { config: PathBuf }, + + /// Print the supported plugin kinds + #[clap(name = "get-plugin-kinds")] + GetPluginKinds, } diff --git a/tedge/src/main.rs b/tedge/src/main.rs index 1293cf58..14031820 100644 --- a/tedge/src/main.rs +++ b/tedge/src/main.rs @@ -137,6 +137,15 @@ async fn main() -> miette::Result<()> { info!("Configuration validated"); Ok(()) } + cli::CliCommand::GetPluginKinds => { + use std::io::Write; + + let mut out = std::io::stdout(); + for name in application.plugin_kind_names() { + writeln!(out, "{}", name).into_diagnostic()?; + } + Ok(()) + } } } |