-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to pass free arguments to a specific place #155
Comments
Hi @ItsDrike, I agree this is an issue, but I've not managed to find a good solution yet. One difficulty is that I haven't found a robust way to pass arguments to a shell child process (to populate $@ within the shell) where the script content is being passed via stdin (which is how shell tasks work). Rethinking shell tasks as discussed in #64 might help, but that's a way off on the roadmap. Thinking allowed here, maybe just having a way to capture extra arguments (either when there are no args defined, or when provided after the I'm open to ideas. That said, one imperfect solution that might just work for you is to define a positional arg on your task that accepts multiple values. For example given a task like: [tool.poe.tasks.show-args]
cmd = """
python -c "import sys; print(sys.argv[1:])" being $all_args end
"""
args = [{ name = "all_args", positional = true, multiple = true }] And a command like: poe show-args middle "multiple words" -- and then some The result will be:
A couple of points to pay attention to:
|
I was hoping to migrate from Makefile to a better tool and found this library. I found a similar limitation with regards to running command inside a docker container. For example when running Django commands, I have to do I also used |
I agree that You can put arguments in an environment variable and use it wherever the arguments are going to be passed: [tool.poe.tasks.test]
sequence = [
{ cmd = 'pytest $TEST_ARGS' },
{ cmd = 'some other command' }
]
Which isn't very elegant but at least it works. |
With shell scripts, it's possible to do something like:
python -m robot --pythonpath . -d ./outptut "$@" tests
, so that when you call a script, the passed arguments are forwarded to the command in a specific location.However with poe a task like:
Any passed arguments will simply be appended to the end of the command. This isn't ideal, as some CLI tools only support usage like:
robot [options] paths
, which means any positional arguments left after the options are interpreted as paths. This means that running for example:robot --pythonpath . ./tests -d ./output
wouldn't work, and I'd get an error that it couldn't find-d
as a path.I'd love to see a feature that would allow for me to pass arguments to a specific place in my command.
The text was updated successfully, but these errors were encountered: