Skip to content

Commit

Permalink
Moved example config, removed deprecated AppSettings traits in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Téo Haÿs committed Feb 25, 2022
1 parent 07ee689 commit 8f961c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion setup_files/gateway/build_and_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ cargo build --release
sudo cp ./target/release/baleine /bin/baleine

mkdir /etc/baleine
[ $? -eq 0 ] && cp ./baleine.example.conf /etc/baleine/baleine.conf || echo "Done."
[ $? -eq 0 ] && cp ./setup_files/gateway/baleine.example.conf /etc/baleine/baleine.conf || echo "Done."
21 changes: 8 additions & 13 deletions src/args.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use clap::{Parser, Subcommand, AppSettings, ArgSettings, crate_version};
use clap::{Parser, Subcommand, crate_version};

#[derive(Parser, Debug)]
#[clap(name = "baleine")]
Expand All @@ -7,34 +7,31 @@ use clap::{Parser, Subcommand, AppSettings, ArgSettings, crate_version};
#[clap(about = "Deploys Docker containers using Rhubarbe.
Report a bug : https://github.com/haysberg/baleine/issues
Wiki : https://github.com/haysberg/baleine/wiki")]
#[clap(setting(AppSettings::SubcommandRequiredElseHelp))]
#[clap(setting(AppSettings::DontCollapseArgsInUsage))]
#[clap(setting(AppSettings::UseLongFormatForHelpSubcommand))]
#[clap(setting(AppSettings::PropagateVersion))]
#[clap(subcommand_required = true)]
#[clap(dont_collapse_args_in_usage = true)]
#[clap(propagate_version = true)]
pub struct EntryArgs {
#[clap(subcommand)]
pub action: Action,
}

#[derive(Subcommand, Debug)]
#[clap(setting(AppSettings::TrailingVarArg))]
#[clap(setting(AppSettings::DontDelimitTrailingValues))]
#[clap(setting(AppSettings::AllowHyphenValues))]
#[clap(trailing_var_arg = true)]
#[clap(dont_delimit_trailing_values = true)]
#[clap(allow_hyphen_values = true)]
pub enum Action {
#[clap(about = "deploys the selected container on nodes")]
#[clap(setting(AppSettings::AllowHyphenValues))]
#[clap(allow_hyphen_values = true)]
Deploy {
#[clap(help = "the image to deploy, <repository>/image:tag format")]
#[clap(required = true, short, long)]
image: String,

#[clap(help = "the options string that you want to send to the container")]
#[clap(setting(ArgSettings::MultipleValues))]
#[clap(short, long)]
options: Option<Vec<String>>,

#[clap(help = "nodes you want to deploy the container on, using the rhubarbe format")]
#[clap(setting(ArgSettings::MultipleValues))]
#[clap(short, long)]
nodes: Option<Vec<String>>,

Expand All @@ -43,7 +40,6 @@ pub enum Action {
bootstrap: Option<String>,

#[clap(help = "Use this option to choose what command to pass to the container. ALWAYS USE LAST.")]
#[clap(setting(ArgSettings::MultipleValues))]
#[clap(short, long)]
command: Option<Vec<String>>
},
Expand All @@ -55,7 +51,6 @@ pub enum Action {
yes: bool,

#[clap(help = "nodes you want to destroy in the rhubarbe format")]
#[clap(setting(ArgSettings::MultipleValues))]
#[clap(short, long)]
nodes: Option<Vec<String>>,
},
Expand Down

0 comments on commit 8f961c6

Please sign in to comment.