Hacker News new | ask | show | jobs
by btbytes 2434 days ago
D's default package manager already allows you to write code like this which 1. runs the code like a script 2. downloads dependencies if they are required.

    #!/usr/bin/env dub
    /+ dub.sdl:
        name "allthepythons"
        dependency "d-glob" version="~>0.3.0"
    +/

    import std.stdio : stdout;
    import glob : glob;
    
    void main () {
        foreach (entry ; glob("/usr/local/bin/python*")) {
            stdout.writefln("%s", entry);
        }
    }
1 comments

Dub's documentation should use some love...