Skip to content

Commit

Permalink
#39: supersede role
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Flamm committed Jul 26, 2018
1 parent ad08eb4 commit 0009bd0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion afpre
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ usage: ${0} [OPTIONS] (-- COMMAND)
OPTIONS
--help ... print this help
--account=<my.account> ... authenticate towards this account, supersedes
--account=<my.account> ... authenticate for this account, supersedes
any definition in ${CFG}
--role=<my.role> ... authenticate as this role, supersedes
any definition in ${CFG}
--example-cfg ... create an example config file at ${CFG}
--debug ... enable debugging
Expand Down Expand Up @@ -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

Expand All @@ -107,13 +110,15 @@ $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

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
Expand Down

0 comments on commit 0009bd0

Please sign in to comment.