Command Line Application in D
TJB via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Aug 5 14:47:40 PDT 2014
This is exactly what I was thinking. Thanks so much for your
help!
TJB
> Just a little something I made for you. Untested of course. But
> takes an argument from cli, which is a glob. Foreach file under
> current working directory, if its a file write out processing.
>
> (I gave std.stdio an alias because std.file and std.stdio
> conflict for some symbols)
>
> import std.file;
> import stdio = std.stdio;
>
> void main(string[] args) {
> if (args.length == 2) {
> foreach(entry; dirEntries(".", args[1], SpanMode.Depth)) {
> if (isDir(entry.name)) {
> } else if (isFile(entry.name)) {
> stdio.writeln("Processing " ~ entry.name);
> }
> }
> } else {
> stdio.writeln("Arguments: <glob>");
> }
> }
More information about the Digitalmars-d-learn
mailing list