Skip to content

Commit

Permalink
Use equal for params
Browse files Browse the repository at this point in the history
  • Loading branch information
academo committed Sep 21, 2021
1 parent 19f2dd0 commit e32521b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/commands/kibana.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def kibana(save_config, unparsed_args, wait):
if "kibana.params" in config:
config_params = config.items("kibana.params", raw=True)

params = merge_params(config_params, unparsed_args)
params = merge_params(config_params, unparsed_args, useEqual=True)

if save_config:
persist_config({"kibana.params": unparsed_to_map(params)})
Expand Down
17 changes: 12 additions & 5 deletions src/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def find_related_plugin_folder(file):
return str(path)


def merge_params(config_params, unparsed_args):
def merge_params(config_params, unparsed_args, useEqual=False):
final_params = []
params_map = {}
for conf, value in config_params:
Expand All @@ -123,10 +123,17 @@ def merge_params(config_params, unparsed_args):
if nextIsValue:
skip = True

for param in params_map:
final_params.append(param)
if len(params_map[param]) > 0:
final_params.append(params_map[param])
if useEqual:
for param in params_map:
if len(params_map[param]) > 0:
final_params.append(param + "=" + params_map[param])
else:
final_params.append(param)
else:
for param in params_map:
final_params.append(param)
if len(params_map[param]) > 0:
final_params.append(params_map[param])

return final_params

Expand Down

0 comments on commit e32521b

Please sign in to comment.