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
Script arguments can't start with a dash #479
Comments
What if you try In general, I would like a better system to distinguish Ammonite args vs script args, but haven't come up with a good one yet |
My proposal is simple: arguments before the script file belong to Ammonite. Example:
Do you like the idea? In this way, there is no need to use |
In addition, my script cannot receive arguments that begin with double slash, even when using Example:
|
Having "pre-file" args be passed to the runtime, and "post-file" args be passed to the script seems like a good compromise to me. This would require some rewriting of the main method: I don't think the scopts library we're using supports this, and trying to identify the script is probably harder than trying to identify the |
OK. I'll try to, when I have time. |
Any hint please of the related source files to modify? |
I think I've found it: |
yep that's the place |
Hey @lihaoyi, I've been trying to write 'standalone' scripts with ammonite, such that I can write an arbitrary program without the user needing to know that it's ammonite running it. Currently ammonite will always try to parse everything after
because ammonite's argument parser is expecting another string after --hello (keyword args) . Therefore we should add an option to disable ammonite's command line parsing What do you think? I've started on this and planning to name the flag |
@lihaoyi Any chance this PR could be reviewed, or anything along the lines could be implemented? I had a quick look at the the commits that @jtcwang did (https://github.com/hubertp/Ammonite/tree/issue/479) and fixed some simple failing tests. I'm happy to clean it up more if there is a will, because I need that feature. |
Fixed in c605d86#diff-d624941e18d4c528c725d4c3c0bd0517R1089 This lets Please take a look at the changelog entry which describes this and let me know if this satisfies your requirements |
I have a script that has these contents:
My script can't receive arguments that start with a dash, because they are taken as Ammonite arguments, instead of arguments for my script.
If I try to use e.g.
then this is the ouput:
The text was updated successfully, but these errors were encountered: