Code Monkey home page Code Monkey logo

clapper's People

Contributors

thatisuday avatar

Stargazers

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

Watchers

 avatar  avatar

clapper's Issues

Discussion: Feature appetite

You mention that you'd accept a PR for combined boolean short flags (-a -b ~= -ab). What is your appetite for these features:

  • Argument type assertions. E.g., if the default value is time.Time, the value is returned as a time.Time). Generics may keep this addition small (LOC)
  • Choices: if the default value is an array, then only values from the array are accepted as valid. E.g.
    infoCommand.AddArg("subjects...", ["chemistry", "physics", "algorithms")
    command, err := registry.Parse([]string{"--subjects", "poetry"})
    // err => InvalidChoiceError{Arg: "subjects", Value: "poetry"}
  • Mandatory/optional. Mandatory flags must be provided, or result in a parsing error. The most backwards-compatible API change would be adding a function, AddReqFlag().

My priority preference are in that order: combined short bool flags, types, and choices. Mandatory flags, I'm not strongly opinionated about, as it's easily enough handled outside the library. But I think the first three -- with Go's new support for generics -- would be relatively minor and easily backwards-compatible.

If you're open to PRs, I'll have a crack at all of them; if you have an opinion on how they look, I'd rather discuss up front than have to change the design at merge time. The biggest impact would be a dependency on Go 1.19+.

Combined short flags is straightforward, API-wise. Type assertions and choices, I think can be added without changing the current API at all.

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.