D for scripting?

Laeeth Isharc via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 22 04:54:30 PST 2017


On Friday, 20 January 2017 at 03:59:12 UTC, 岩倉 澪 wrote:
> Is anyone else using D for scripting?

Yes!

> I keep my scripts in ~/scripts so that I can just pull them 
> from github and go on my merry way, with symlinks in 
> /usr/local/bin, but rdmd doesn't -I the real directory, it does 
> -I/usr/local/bin, and if I symlink a script.d as 
> /usr/local/bin/script, it can't find the module.
> I can pass -I/home/mio/scripts on the shebang line at least...
>
> Furthermore, if I -J a folder with string imports I would have 
> to type out the fully qualified path just like with -I. It 
> would be so much more convenient if rdmd would follow the 
> symlink to the scripts directory, change the working directory, 
> and then compile, or something like that.
>
> I feel like the shebang is totally worth it if I could name my 
> file without .d and symlink to it. Would it be reasonable to 
> change rdmd to allow these features? I'd be happy to look into 
> writing a patch for it if it wouldn't be a waste of time.

No comments on rdmd, but have you tried using dub instead of rdmd 
for scripts.  Makes it easier if you have dependencies on 
code.dlang.org modules.  You can embed the dub.sdl in the header 
of your script.




More information about the Digitalmars-d mailing list