You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by "Xavier Hanin (JIRA)" <ji...@apache.org> on 2007/04/25 17:01:15 UTC

[jira] Commented: (IVY-480) Allow "main" parameters to be passed directly (instead of using -args flag)

    [ https://issues.apache.org/jira/browse/IVY-480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491704 ] 

Xavier Hanin commented on IVY-480:
----------------------------------

I think you can put as many arguments as you want after the {{-args}} (eg {{java fr.jayasoft.ivy.Main -main com.exmaple.Main -args foo bar}}), which makes it already pretty easy to use with shell scripts and justify the naming. 

Could you confirm if it works for you, and tell if you still think deprecating {{-args}} would be better?

> Allow "main" parameters to be passed directly (instead of using -args flag)
> ---------------------------------------------------------------------------
>
>                 Key: IVY-480
>                 URL: https://issues.apache.org/jira/browse/IVY-480
>             Project: Ivy
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.4.1
>            Reporter: Archie Cobbs
>
> When running ivy in standalone mode using the {{-main}} flag, any extra parameters passed on the command line (i.e., not as flag arguments) are simply ignored.
> E.g., if I invoke {{java fr.jayasoft.ivy.Main -main com.exmaple.Main foo bar}} the {{foo bar}} parameters are ignored. To pass "foo" and "bar" to my main method, I have to use {{-args foo}} and {{-args bar}}.
> Suggestion: when using the {{-main}} flag, allow the parameters to the main method to be passed directly on the command line as "extra" parameters, as an alternative to using the {{-args}} flag.
> The motivation for this is that this would be much easier to deal with in shell scripts. E.g. suppose I want to write a shell script {{/usr/bin/foo}} which uses ivy to resolve dependencies and execute some main class {{com.example.foo.Main}}. To do this I'd have to parse the command line into individual arguments, then precatenate each one with a {{-args}} flag, etc. This sounds hard enough, but when you consider that some parameters may be quoted, it becomes nearly impossible. With the change suggested here, it would become trivial: I'd just do something like {{ivy -ivy /usr/share/foo.ivy -main com.example.foo.Main ${1+"$@"} }} in the shell script.
> If this is implemented, it should probably become the recommended approach, and {{-args}} be deprecated.
> As a side note, the {{-args}} flag is mis-named: it should be called {{-arg}} instead (but I'd prefer to have it just be deprecated).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.