Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Commit e87abc7

Browse files
committed
#156 support top-level --region option
1 parent 66a4d66 commit e87abc7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

senza/cli.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@
9898
'ResourceStatusReason': 50
9999
}
100100

101+
GLOBAL_OPTIONS = {}
102+
101103

102104
def print_json(data, output=None):
103105
if output == 'yaml':
@@ -277,8 +279,9 @@ def is_credentials_expired_error(e: ClientError) -> bool:
277279
@click.group(cls=AliasedGroup, context_settings=CONTEXT_SETTINGS)
278280
@click.option('-V', '--version', is_flag=True, callback=print_version, expose_value=False, is_eager=True,
279281
help='Print the current version number and exit.')
280-
def cli():
281-
pass
282+
@region_option
283+
def cli(region):
284+
GLOBAL_OPTIONS['region'] = region
282285

283286

284287
class TemplateArguments:
@@ -442,6 +445,8 @@ def parse_args(input, region, version, parameter, account_info):
442445

443446

444447
def get_region(region):
448+
if not region:
449+
region = GLOBAL_OPTIONS.get('region')
445450
if not region:
446451
config = configparser.ConfigParser()
447452
try:

0 commit comments

Comments
 (0)