Skip to content

Commit

Permalink
fix(cli): proper opts override for workflows (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocervell authored Sep 17, 2024
1 parent f45b123 commit 1d1eaa3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions secator/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,17 @@ def func(ctx, **opts):
driver = opts.pop('driver', '')
show = opts['show']
context = {'workspace_name': ws}

# Remove options whose values are default values
for k, v in options.items():
opt_name = k.replace('-', '_')
if opt_name in opts and opts[opt_name] == v.get('default', None):
del opts[opt_name]

# TODO: maybe allow this in the future
# unknown_opts = get_unknown_opts(ctx)
# opts.update(unknown_opts)

targets = opts.pop(input_type)
targets = expand_input(targets)
if sync or show:
Expand Down
4 changes: 2 additions & 2 deletions secator/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ def merge_opts(*options):
all_opts = {}
for opts in options:
if opts:
opts_noemtpy = {k: v for k, v in opts.items() if v is not None}
all_opts.update(opts_noemtpy)
opts_noempty = {k: v for k, v in opts.items() if v is not None}
all_opts.update(opts_noempty)
return all_opts


Expand Down

0 comments on commit 1d1eaa3

Please sign in to comment.