Added version subcommand

This commit is contained in:
Joe Bellus 2021-11-15 09:57:12 -05:00
parent dcc21964f6
commit 708896b58e
2 changed files with 13 additions and 6 deletions

View File

@ -19,7 +19,8 @@ build-linux:
- linux
script:
- cargo build --release
- tar -czvf conductor-linux.tar.gz target/release/conductor
- cd target/release
- tar -czvf conductor-linux.tar.gz /conductor
artifacts:
paths:
@ -45,12 +46,13 @@ build-macos:
- macos
script:
- cargo build --release
- tar -czvf conductor-macos.tar.gz target/release/conductor
- cd target/release
- tar -czvf conductor-macos.tar.gz conductor
artifacts:
paths:
- conductor-macos.tar.gz
deploy:
upload:
stage: deploy
dependencies:
- build-linux
@ -64,7 +66,6 @@ deploy:
script:
- ls -thora
- aws s3 cp ./conductor-linux.tar.gz s3://shared.5sigma.io/conductor/conductor-linux.tar.gz
- aws s3 cp ./conductor-linux.tar.gz s3://shared.5sigma.io/conductor/conductor-macos.tar.gz
- aws s3 cp ./conductor-macos.tar.gz s3://shared.5sigma.io/conductor/conductor-macos.tar.gz
- aws s3 cp ./target/release/conductor.exe s3://shared.5sigma.io/conductor/conductor.exe

View File

@ -12,7 +12,8 @@ mod runner;
#[actix_rt::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let app = arkham::app!()
.opt(Opt::scalar("config").long("config").desc("By default the conductor.yml config file is found in the current directory or any directory above it. It can be manually specified if it exists in a different location."));
.command(Command::new("version").handler(version).long_desc("Display version information"))
.opt(Opt::scalar("config").long("config").desc("By default the conductor.yml config file is found in the current directory or any directory above it. It can be manually specified if it exists in a different location."));
let manual_config = app
.root_context()
.ok()
@ -70,6 +71,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}
fn version(_: &App, _: &arkham::Context, _: &[String]) {
println!(env!("CARGO_PKG_VERSION"));
std::process::exit(0);
}
fn run(_: &App, ctx: &arkham::Context, _: &[String]) {
if let Some(config_path) = ctx
.get_string("config")