Code Monkey home page Code Monkey logo

darg's People

Contributors

a-ludi avatar domain avatar hey-jude avatar jasonwhite avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

darg's Issues

Deprecation warning with DMD v2.079.1

DMD v2.079.1 emits deprecation warning

.dub/packages/darg-0.0.4/darg/source/darg.d(616,12): Deprecation: module `std.traits` member Identity is not visible from module darg

Unable to pass arguments with negative value

Unable to pass CLI arguments with negative values.

import std.stdio;
import darg;

private struct Options {
    @Option("help", "h")
    @Help("Prints this help.")
    OptionFlag help;

    @Option("threshold", "t")
    @Help("Threshold.")
    int threshold;
}

// Generate the usage and help string at compile time.
private immutable usage = usageString!Options("darg-sample");
private immutable help = helpString!Options;

void main(string[] args) {
    __gshared Options options;
    try {
        options = parseArgs!Options(args[1 .. $]);
    }
    catch (ArgParseError e) {
        writeln(e.msg);
        writeln(usage);
        return;
    }
    catch (ArgParseHelp e) {
        // Help was requested
        writeln(usage);
        write(help);
        return;
    }
    writeln("Success");
}
21:42:51 ~/code/test $ ./darg-sample -t 1
Success
21:42:55 ~/code/test $ ./darg-sample -t -1
Expected argument for option '-t'
Usage: darg-sample [--help] [--threshold=<int>]

Compiler error while importing std.experimental.all

std.experimental.all is a nice way to import all the symbols in a single statement. But doing so when darg is imported results in the below compiler error.

src\app.d(58,6): Error: darg.Option at ..\..\..\..\AppData\Local\dub\packages\darg-0.1.0\darg\source\darg.d(41,1) conflicts with std.getopt.Option at C:\DevEnv\D\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(500,1)
..\..\..\..\AppData\Local\dub\packages\darg-0.1.0\darg\source\darg.d(854,25): Error: template instance `app.Options.getUDAs!(help, Option)` error instantiating
src\app.d(220,27):        instantiated from here: usageString!(Options)

Multiplicity of Options

Is it possible to accept an option multiple times? I tried a couple of approaches, but was unable to get it to work.

Named Arguments or Mandatory Options

I was thinking about having named arguments or mandatory options. This need arises from the fact that I have up to 6 required arguments to my current project which can get quite confusing.

My idea is to implement an UDA NamedArgument that is similar to Option but will raise an error if it is missing in the arguments. I would create a mixin for the common code of the two to avoid code duplication.

I would love to get some feedback about this idea.

Request for integrating into Hunt

We are maintaining a basic module library for D programming, which is called Huntใ€‚We like this project very much.
It's so sad to see it is no longer maintained. So, we want to integrate it into Hunt and continue improving it to satify the more future requirements. See here.
Any ideas can let us known. Thanks for your works.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.