digitalmars.D.learn - Command Line Application in D
- TJB (8/8) Aug 04 2014 I am trying to build some simple command line applications that I
- maarten van damme via Digitalmars-d-learn (6/13) Aug 04 2014 I am a little bit confused as to what you want.
- TJB (5/10) Aug 04 2014 Sorry. I wasn't very clear. Say I want to find all of the files
- Rikki Cattermole (20/29) Aug 04 2014 Just a little something I made for you. Untested of course. But takes an...
- TJB (3/22) Aug 05 2014 This is exactly what I was thinking. Thanks so much for your
- Mike James (4/14) Aug 04 2014 Have a look at the function dirEntries in std.file.
I am trying to build some simple command line applications that I have written in python as a way to learn D. Can you give some examples for me? For instance, I think I remember once seeing somewhere in the documentation an example that took several D files and compiled them all by running some kind of system command. I much appreciate your help! TJB
Aug 04 2014
I am a little bit confused as to what you want. There is a command line example at dlang.org, and there exists a program (rdmd) that compiles several D files and runs them. http://dlang.org/rdmd.html 2014-08-04 23:20 GMT+02:00 TJB via Digitalmars-d-learn < digitalmars-d-learn puremagic.com>:I am trying to build some simple command line applications that I have written in python as a way to learn D. Can you give some examples for me? For instance, I think I remember once seeing somewhere in the documentation an example that took several D files and compiled them all by running some kind of system command. I much appreciate your help! TJB
Aug 04 2014
On Monday, 4 August 2014 at 21:58:09 UTC, maarten van damme via Digitalmars-d-learn wrote:I am a little bit confused as to what you want. There is a command line example at dlang.org, and there exists a program (rdmd) that compiles several D files and runs them. http://dlang.org/rdmd.htmlSorry. I wasn't very clear. Say I want to find all of the files that have a certain extension within a directory and process them somehow at the command line. How could I do that?
Aug 04 2014
On 5/08/2014 10:03 a.m., TJB wrote:On Monday, 4 August 2014 at 21:58:09 UTC, maarten van damme via Digitalmars-d-learn wrote: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>"); } }I am a little bit confused as to what you want. There is a command line example at dlang.org, and there exists a program (rdmd) that compiles several D files and runs them. http://dlang.org/rdmd.htmlSorry. I wasn't very clear. Say I want to find all of the files that have a certain extension within a directory and process them somehow at the command line. How could I do that?
Aug 04 2014
This is exactly what I was thinking. Thanks so much for your help! TJBJust 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>"); } }
Aug 05 2014
On Monday, 4 August 2014 at 22:03:24 UTC, TJB wrote:On Monday, 4 August 2014 at 21:58:09 UTC, maarten van damme via Digitalmars-d-learn wrote:Have a look at the function dirEntries in std.file. regards, -<mike>-I am a little bit confused as to what you want. There is a command line example at dlang.org, and there exists a program (rdmd) that compiles several D files and runs them. http://dlang.org/rdmd.htmlSorry. I wasn't very clear. Say I want to find all of the files that have a certain extension within a directory and process them somehow at the command line. How could I do that?
Aug 04 2014