Skip to content
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

Enable args in script #538

Closed
ctongfei opened this issue Dec 30, 2016 · 4 comments
Closed

Enable args in script #538

ctongfei opened this issue Dec 30, 2016 · 4 comments

Comments

@ctongfei
Copy link

@ctongfei ctongfei commented Dec 30, 2016

Is it possible to enable access to args variable in code without a function annotated with @main?
It'd be good if args can be accessed.

@jatcwang
Copy link

@jatcwang jatcwang commented Jan 1, 2017

This feature is part of #423 which I'm currently working on.

@lihaoyi
Copy link
Member

@lihaoyi lihaoyi commented May 19, 2017

Fixed in c605d86#diff-d624941e18d4c528c725d4c3c0bd0517R1089

This lets @main methods with varargs properly slurp in everything, allowing you to then use your own custom argument parser. The only caveat is you cannot use -- in your own argument list, since that is reserved to separate Ammonite's arguments from your script's arguments.

Please take a look at the changelog entry which describes this and let me know if this satisfies your requirements

@lihaoyi lihaoyi closed this May 19, 2017
@lihaoyi
Copy link
Member

@lihaoyi lihaoyi commented May 21, 2017

@jatcwang
Copy link

@jatcwang jatcwang commented May 23, 2017

Excellent will give it a go. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants