Open billbrod opened 4 years ago
I think that is because args
is the last argument, which would get passed to the script.
I think I would suggest two things:
--
before passing in args. That way there is a clear separation of the two. It could also warn that args are not supported for the static parser.--static
flag. Because really they are doing two different things.Putting both together, commands would look like:
$python -m r2t2 static example1.py example2.py
$python -m r2t2 run example1.py -- arg1 arg2
(static
may not be the best sub command name)
I like the idea of sub-commands, from a user's perspective that's much clearer (and I think static
is fine).
I also think using --
to clearly separate args from targets makes sense; while putting this issue together, I completely missed the fact that the scripts also accept args and that was where the issue was coming from.
The run
sub-command would only accept one target, right? It should raise an Exception (or a warning or something) if multiple targets are passed?
The
run
sub-command would only accept one target, right? It should raise an Exception (or a warning or something) if multiple targets are passed?
Yes, at the moment it accepts only one argument, and it cannot be a directory I believe (unlike for the static checker). That differentiation would also be more clear with sub commands.
If the format argument is used, then it will default to output to the directory of the passed in script. Not quite sure what to do if multiple files are passed in. It should probably write to each of the target directories. But that requires a change to the output handlers.
If you pass multiple targets to the static tracker, it will only give the outputs from the first file, silently ignoring the rest. This is true for static by itself, and also with the
--docstring
flag. It should probably either parse all the files or raise an Exception if it gets multiple files?Minimal working example:
file
example1.py
:file
example2.py
:Run:
Output:
Expected output: