I'm not sure that packages should export main() functions – that's going to 
complicated things when a user wants to require CRC and define their own 
main().

How about leaving it unexported and using julia -e "using PKG; 
PKG.main(ARGS)"?

On Sunday, 27 April 2014 16:12:41 UTC+1, andrew cooke wrote:
>
> Just to follow-up on this.  The simplest way to bundle a command line 
> utility with a package seems to be:
>
> - use ArgeParse as normal and define a main(ARGS) function
> - export the main() function from the package
> - tell the user to call or alias  julia -e "using PKG; main(ARGS)"
>
> This works because julia itself only interprets options *before* -e.  
> Options *after* -e are passed in ARGS.  I guess this is obvious in 
> retrospect - it couldn't really be any other way.
>
> Doing it this way means that only an "alias" or similar needs to be 
> defined.  The user doesn't need to know where any Julia-related files are 
> installed.
>
> Andrew
>
>

Reply via email to