From 0009bd00e3da90661eb24b3d809fb28b7651ee80 Mon Sep 17 00:00:00 2001 From: Christian Flamm Date: Thu, 26 Jul 2018 09:45:52 +0200 Subject: [PATCH] #39: supersede role --- afpre | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/afpre b/afpre index 7c94dd0..f58542c 100755 --- a/afpre +++ b/afpre @@ -56,7 +56,9 @@ usage: ${0} [OPTIONS] (-- COMMAND) OPTIONS --help ... print this help - --account= ... authenticate towards this account, supersedes + --account= ... authenticate for this account, supersedes + any definition in ${CFG} + --role= ... authenticate as this role, supersedes any definition in ${CFG} --example-cfg ... create an example config file at ${CFG} --debug ... enable debugging @@ -99,6 +101,7 @@ ARGS="${@}" options_contain '--help' && do_help options_contain '--version' && do_version options_contain '--account' && ADHOC_ACCOUNT=$(longoption_value account) +options_contain '--role' && ADHOC_ROLE=$(longoption_value role) options_contain '--example-cfg' && do_example_cfg options_contain '--debug' && DEBUG=true @@ -107,6 +110,7 @@ $DEBUG && set -x check_deps which curl jq openssl check_config_file variable_empty "${ADHOC_ACCOUNT}" && check_config_key ACCOUNT +variable_empty "${ADHOC_ROLE}" && check_config_key ROLE check_config_key ROLE check_config_key _PATH check_config_key HOST @@ -114,6 +118,7 @@ check_config_key HOST source $CFG variable_empty "${ADHOC_ACCOUNT}" || ACCOUNT="${ADHOC_ACCOUNT}" +variable_empty "${ADHOC_ROLE}" || ROLE="${ADHOC_ROLE}" variable_empty "${NAME}" && read -p "username: " NAME variable_empty "${PW}" && { read -p "password: " -s PW