Skip to content

Commit

Permalink
based on exit code early return of bash script
Browse files Browse the repository at this point in the history
  • Loading branch information
snigdhasjg committed Nov 30, 2023
1 parent e5285b3 commit 602e919
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aws_fusion/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.5.1'
__version__ = '1.5.2'
4 changes: 2 additions & 2 deletions aws_fusion/commands/config_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def switch_profile(args):
answers = inquirer.prompt([profile_inquiry], theme=inquirer.themes.GreenPassion(), raise_keyboard_interrupt=True)
except KeyboardInterrupt:
LOG.warning('Cancelled by user')
exit(7)
exit(73)

profile = answers.get('profile') if answers.get('profile') != 'default' else None
__update_file('profile', profile)
Expand All @@ -46,7 +46,7 @@ def switch_region(args):
answers = inquirer.prompt([region_inquery], theme=inquirer.themes.GreenPassion(), raise_keyboard_interrupt=True)
except KeyboardInterrupt:
LOG.warning('Cancelled by user')
exit(7)
exit(73)

region = answers.get('region') if answers.get('region') != session.region_name else None
__update_file('region', region)
Expand Down
4 changes: 3 additions & 1 deletion bin/_awsp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash

aws-fusion config-switch profile
# If non-zero status from program, then exit from here
[ $? -ne 0 ] && return

selected_profile="$(cat ~/.aws/fusion/profile)"

# Unset region as switching profile
# Unset region as switching profile, will use the region which is set by the profile
unset AWS_REGION

if [ -z "$selected_profile" ]
Expand Down
2 changes: 2 additions & 0 deletions bin/_awsr
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash

aws-fusion config-switch region
# If non-zero status from program, then exit from here
[ $? -ne 0 ] && return

selected_region="$(cat ~/.aws/fusion/region)"

Expand Down

0 comments on commit 602e919

Please sign in to comment.