Skip to content

Commit

Permalink
use orig cli arg if available i/o stringly dump
Browse files Browse the repository at this point in the history
This patch changes the way cli.run generates an argument overview to be placed
in the preamble of the html log. Rather than calling stringly.dumps on all
arguments, the new approach logs the original string arguments, and stringly
dumps only non-overridden function defaults.
  • Loading branch information
gertjanvanzwieten committed Nov 5, 2021
1 parent a9d7880 commit f226d3f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nutils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,10 @@ def run(func, *, args=None, loaduserconfig=True):
sys.exit(2)
(funcargs if name in sig.parameters else setupargs)[name] = value

kwargs = [(param.name, stringly.dumps(types[param.name], funcargs.get(param.name, param.default)), argdocs.get(param.name)) for param in sig.parameters.values()]
kwargs = [(param.name,
strargs[param.name] if param.name in strargs
else stringly.dumps(types[param.name], funcargs.get(param.name, param.default)),
argdocs.get(param.name)) for param in sig.parameters.values()]

with setup(scriptname=scriptname, kwargs=kwargs, **setupargs):
func(**funcargs)
Expand Down

0 comments on commit f226d3f

Please sign in to comment.