the D scripting language -- command line

2010-11-11 Thread spir
[started separate thread] On Thu, 11 Nov 2010 00:58:31 +0100 Tomek Sowiński wrote: > Andrei Alexandrescu napisał: > > >> Speaking of getopt, when writing the 'grep' snippet I missed anonymous > >> options a lot: > >> > >> bool h, i; string expr; string[] files; > >> getopt(args, "h",&h, "i",&i,

Re: the D scripting language -- command line

2010-11-11 Thread ruben niemann
spir Wrote: > [started separate thread] > > On Thu, 11 Nov 2010 00:58:31 +0100 > Tomek Sowiński wrote: > > > Andrei Alexandrescu napisał: > > > > >> Speaking of getopt, when writing the 'grep' snippet I missed anonymous > > >> options a lot: > > >> > > >> bool h, i; string expr; string[] fil

Re: the D scripting language -- command line

2010-11-11 Thread sop
ruben niemann Wrote: > spir Wrote: > > > [started separate thread] > > > > On Thu, 11 Nov 2010 00:58:31 +0100 > > Tomek Sowiński wrote: > > > > > Andrei Alexandrescu napisał: > > > > > > >> Speaking of getopt, when writing the 'grep' snippet I missed anonymous > > > >> options a lot: > > >

Re: the D scripting language -- command line

2010-11-11 Thread Adam Ruppe
spir wrote: > I thought once at a default interface between the command-line and a > program's startup routine, main(). We could actually do this with a mixin. == int findword (string filename, string word, bool verbose=false) {...} mixin MakeMain!(findword); == And that MakeMain temp

Re: the D scripting language -- command line

2010-11-11 Thread Lars T. Kyllingstad
On Thu, 11 Nov 2010 13:45:33 +, Adam Ruppe wrote: > I actually wrote something that does this already, though my goal was to > automate the creation of web apps, it also (used to - I broke it in my > last revision) works for command line programs. > > http://arsdnet.net/dcode/web.d > > [...]

Re: the D scripting language -- command line

2010-11-11 Thread Adam Ruppe
Lars T. Kyllingstad wrote: > Have you ever considered cleaning it up and publishing it as > a web app library for D, either on dsource or somewhere similar? Yes, I'd like to do that eventually, but haven't gotten around to it yet. You can see, looking through the code, that I've been lax on docum

Re: the D scripting language -- command line

2010-11-11 Thread Tomek Sowiński
spir napisał: >> // Let's match assignments. >> auto args = ["program.exe", ".*=.*;", "file1.d", "file2.d", "file3.d"]; >> bool h, i; string expr; string[] files; >> getopt(args, "h",&h, "i",&i, &expr, &files); >> assert(!h); >> assert(!i); >> assert(expr == ".*=.*;"); >> assert(files == ["file1.d