www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Command Line Utility Library

reply UDW <ulyssesdwolfe gmail.com> writes:
Hi,

I would like some options for a library, preferably json 
configurable, that helps with command line tool development. 
Doesn't have to be in D specifically.


Currently I am using using std.getopt. I had a search in the DUB 
repos and in github but didn't really find anything appealing.

ty ss <3
Aug 15 2016
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2016-08-15 09:29, UDW wrote:
 Hi,

 I would like some options for a library, preferably json configurable,
 that helps with command line tool development. Doesn't have to be in D
 specifically.


 Currently I am using using std.getopt. I had a search in the DUB repos
 and in github but didn't really find anything appealing.
I think you need to be a bit more specific on what you need. -- /Jacob Carlborg
Aug 15 2016
parent reply Seb <seb wilzba.ch> writes:
On Monday, 15 August 2016 at 09:26:21 UTC, Jacob Carlborg wrote:
 On 2016-08-15 09:29, UDW wrote:
 Hi,

 I would like some options for a library, preferably json 
 configurable,
 that helps with command line tool development. Doesn't have to 
 be in D
 specifically.


 Currently I am using using std.getopt. I had a search in the 
 DUB repos
 and in github but didn't really find anything appealing.
I think you need to be a bit more specific on what you need.
Are you trying to parse arguments? There's a lot of good stuff for it already: https://dlang.org/phobos/std_getopt.html https://code.dlang.org/packages/darg https://blog.thecybershadow.net/2014/08/05/ae-utils-funopt/ For configuration files: https://code.dlang.org/packages/onyx-config https://code.dlang.org/packages/inid https://code.dlang.org/packages/yamkeys https://code.dlang.org/packages/runtimer https://code.dlang.org/packages/variantconfig
Aug 15 2016
next sibling parent reply UDW <ulyssesdwolfe gmail.com> writes:
On Monday, 15 August 2016 at 10:48:11 UTC, Seb wrote:

 Are you trying to parse arguments?
 There's a lot of good stuff for it already:

 https://dlang.org/phobos/std_getopt.html
 https://code.dlang.org/packages/darg
 https://blog.thecybershadow.net/2014/08/05/ae-utils-funopt/


 For configuration files:

 https://code.dlang.org/packages/onyx-config
 https://code.dlang.org/packages/inid
 https://code.dlang.org/packages/yamkeys
 https://code.dlang.org/packages/runtimer
 https://code.dlang.org/packages/variantconfig
Thanks for the suggestions Seb, https://blog.thecybershadow.net/2014/08/05/ae-utils-funopt/ looks very nice :). I just thought there would be a standard library, stdclib, phobos or otherwise for making CLI tools that would generate sub-commands, options, help text and handle input for it all. Unfortunately my gumby searching didn't find much yesterday. Sort of like this https://github.com/tj/commander.js which I found after a bit more searching. ty again
Aug 15 2016
parent Seb <seb wilzba.ch> writes:
On Tuesday, 16 August 2016 at 01:23:16 UTC, UDW wrote:
 On Monday, 15 August 2016 at 10:48:11 UTC, Seb wrote:

 [...]
Thanks for the suggestions Seb, https://blog.thecybershadow.net/2014/08/05/ae-utils-funopt/ looks very nice :). I just thought there would be a standard library, stdclib, phobos or otherwise for making CLI tools that would generate sub-commands, options, help text and handle input for it all. Unfortunately my gumby searching didn't find much yesterday. Sort of like this https://github.com/tj/commander.js which I found after a bit more searching. ty again
Have you had a detailed look at std.getopt? https://dlang.org/phobos/std_getopt.html That's very similar to commander.js ;-)
Aug 15 2016
prev sibling parent reply Jonathan Marler <johnnymarler gmail.com> writes:
On Monday, 15 August 2016 at 10:48:11 UTC, Seb wrote:
 Are you trying to parse arguments?
 There's a lot of good stuff for it already:

 https://dlang.org/phobos/std_getopt.html
 https://code.dlang.org/packages/darg
 https://blog.thecybershadow.net/2014/08/05/ae-utils-funopt/


 For configuration files:

 https://code.dlang.org/packages/onyx-config
 https://code.dlang.org/packages/inid
 https://code.dlang.org/packages/yamkeys
 https://code.dlang.org/packages/runtimer
 https://code.dlang.org/packages/variantconfig
Seb how in the heck do you know about all these libraries, geeze.
Aug 15 2016
parent reply Jacob Carlborg <doob me.com> writes:
On 2016-08-16 04:29, Jonathan Marler wrote:

 Seb how in the heck do you know about all these libraries, geeze.
Currently Dub has so few libraries that it's possible to manually scan the list. -- /Jacob Carlborg
Aug 15 2016
parent reply Seb <seb wilzba.ch> writes:
On Tuesday, 16 August 2016 at 06:27:12 UTC, Jacob Carlborg wrote:
 On 2016-08-16 04:29, Jonathan Marler wrote:

 Seb how in the heck do you know about all these libraries, 
 geeze.
Currently Dub has so few libraries that it's possible to manually scan the list.
Manual work? O_o Just open code.dlang.org and either hit CTRL-F or use the search bar (Martin added elastic search two months ago) as the packages usually have a very low PageRank. Furthermore the knowledge that the "big/old" players in the D community (CyberShadow, Adam Ruppe, ...) have their own library solution for everything, helps in finding what one is searching for. Additionally there are quite a few discussions about (Phobos) packages, for example a recent one is here: https://forum.dlang.org/thread/ng7iiq$1gnv$1 digitalmars.com?page=1 (the most interesting finding in there is that std.getopt has nothing to do with the getopt program) So no dark magic involved ;-)
Aug 16 2016
parent reply Jacob Carlborg <doob me.com> writes:
On 2016-08-16 11:37, Seb wrote:

 Manual work? O_o
 Just open code.dlang.org and either hit CTRL-F or use the search bar
 (Martin added elastic search two months ago) as the packages usually
 have a very low PageRank.
It's a bit problematic when you don't know what to search for. Not all projects have a descriptive name ;) -- /Jacob Carlborg
Aug 16 2016
parent reply Edwin van Leeuwen <edder tkwsping.nl> writes:
On Tuesday, 16 August 2016 at 13:32:26 UTC, Jacob Carlborg wrote:
 On 2016-08-16 11:37, Seb wrote:

 Manual work? O_o
 Just open code.dlang.org and either hit CTRL-F or use the 
 search bar
 (Martin added elastic search two months ago) as the packages 
 usually
 have a very low PageRank.
It's a bit problematic when you don't know what to search for. Not all projects have a descriptive name ;)
Does it only search the description or also the README?
Aug 16 2016
parent Seb <seb wilzba.ch> writes:
On Tuesday, 16 August 2016 at 13:52:19 UTC, Edwin van Leeuwen 
wrote:
 On Tuesday, 16 August 2016 at 13:32:26 UTC, Jacob Carlborg 
 wrote:
 On 2016-08-16 11:37, Seb wrote:

 Manual work? O_o
 Just open code.dlang.org and either hit CTRL-F or use the 
 search bar
 (Martin added elastic search two months ago) as the packages 
 usually
 have a very low PageRank.
It's a bit problematic when you don't know what to search for. Not all projects have a descriptive name ;)
Does it only search the description or also the README?
https://github.com/dlang/dub-registry/pull/149 Indexing the README is marked as TODO, but it shouldn't be too difficult to add - afaik it's already stored in the database.
Aug 16 2016
prev sibling parent reply Edwin van Leeuwen <edder tkwsping.nl> writes:
On Monday, 15 August 2016 at 07:29:58 UTC, UDW wrote:
 Hi,

 I would like some options for a library, preferably json 
 configurable, that helps with command line tool development. 
 Doesn't have to be in D specifically.
I am using: http://code.dlang.org/packages/docopt It's not really json configurable, but that shouldn't be to complex to implement yourself.
Aug 16 2016
parent UDW <ulyssesdwolfe gmail.com> writes:
On Tuesday, 16 August 2016 at 07:19:18 UTC, Edwin van Leeuwen 
wrote:
 I am using:
 http://code.dlang.org/packages/docopt

 It's not really json configurable, but that shouldn't be to 
 complex to implement yourself.
That's also very nice. I hadn't thought of writing the help text first and then having a parser for the usage to generate options. Much appreciated. On Tuesday, 16 August 2016 at 01:46:53 UTC, Seb wrote:
 Have you had a detailed look at std.getopt?
 https://dlang.org/phobos/std_getopt.html

 That's very similar to commander.js ;-)
I shall reread the std.getopt doco. ty ss :)
Aug 16 2016