diff options
Diffstat (limited to 'src/bin/vmadm.rs')
-rw-r--r-- | src/bin/vmadm.rs | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/bin/vmadm.rs b/src/bin/vmadm.rs index 9b16966..711bc98 100644 --- a/src/bin/vmadm.rs +++ b/src/bin/vmadm.rs @@ -40,6 +40,22 @@ enum Command { spec: PathBuf, }, + Start { + #[structopt(flatten)] + common: CommonOptions, + + #[structopt(parse(from_os_str))] + spec: PathBuf, + }, + + Shutdown { + #[structopt(flatten)] + common: CommonOptions, + + #[structopt(parse(from_os_str))] + spec: PathBuf, + }, + CloudInit { #[structopt(flatten)] common: CommonOptions, @@ -79,6 +95,16 @@ fn main() -> anyhow::Result<()> { cmd::delete(&specs)?; } + Command::Start { common, spec } => { + let specs = get_specs(&common, &spec)?; + cmd::start(&specs)?; + } + + Command::Shutdown { common, spec } => { + let specs = get_specs(&common, &spec)?; + cmd::shutdown(&specs)?; + } + Command::CloudInit { common, spec, @@ -107,11 +133,9 @@ fn config(common: &CommonOptions) -> anyhow::Result<Configuration> { fn config_filename(common: &CommonOptions) -> PathBuf { if let Some(ref filename) = common.config { filename.to_path_buf() + } else if let Some(dirs) = ProjectDirs::from(QUALIFIER, ORG, APP) { + dirs.config_dir().join("config.yaml") } else { - if let Some(dirs) = ProjectDirs::from(QUALIFIER, ORG, APP) { - dirs.config_dir().join("config.yaml") - } else { - PathBuf::from("xxx") - } + PathBuf::from("xxx") } } |