GithubHelp home page GithubHelp logo

hidden arguments? about cmdargs HOT 6 OPEN

LeventErkok avatar LeventErkok commented on June 2, 2024
hidden arguments?

from cmdargs.

Comments (6)

ndmitchell avatar ndmitchell commented on June 2, 2024

Is https://hackage.haskell.org/package/cmdargs-0.10.20/docs/System-Console-CmdArgs-Implicit.html#v:ignore what you are after?

from cmdargs.

LeventErkok avatar LeventErkok commented on June 2, 2024

Thanks Neil!

Unfortunately that's not quite what I want. I still want this to be a valid parameter to the program, just not displayed in the "help" output.

I've found this stack-overflow question that describes the issue https://stackoverflow.com/questions/33199324/hidden-arguments-with-cmdargs

But the accepted solution seems quite hackish and it dates back to 2015. So, I'm wondering if there's a better way to do the same.

from cmdargs.

ndmitchell avatar ndmitchell commented on June 2, 2024

Unfortunately nothing better available I'm afraid. I can't think of a better way than that.

from cmdargs.

LeventErkok avatar LeventErkok commented on June 2, 2024

Thanks! I'll close this ticket; but feel free to re-open it if you want to implement something! It's definitely a nice-to-have. Much appreciated.

from cmdargs.

ndmitchell avatar ndmitchell commented on June 2, 2024

Let's leave open to add - it's pretty hacky as it stands now...

from cmdargs.

LeventErkok avatar LeventErkok commented on June 2, 2024

In case this helps anyone else, I found a workaround that sort of works. You first do:

allNames :: [String]
allNames = concatMap flagNames $ modeFlags defaultOptions

where defaultOptions is the record you construct for arguments. This grabs all the flag names. Then, do a preprocessing step and check all "flag-like" arguments to be in this list before calling cmdArgs itself. If you find anything outside, you can do a more detailed analysis as needed.

Rather hackish, but it does do the trick for my use case. I'd like to hear if anyone has a better idea that doesn't require mocking with cmdArgs itself.

from cmdargs.

Related Issues (20)

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.