GithubHelp home page GithubHelp logo

Filtered argc/argv about cxxopts HOT 3 OPEN

VictorEijkhout avatar VictorEijkhout commented on September 27, 2024
Filtered argc/argv

from cxxopts.

Comments (3)

jarro2783 avatar jarro2783 commented on September 27, 2024

What sort of filtering do you want? Do you mean something like stopping at --?

from cxxopts.

VictorEijkhout avatar VictorEijkhout commented on September 27, 2024

Stopping at -- seems like a reasonable solution.

from cxxopts.

jarro2783 avatar jarro2783 commented on September 27, 2024

Currently it does already stop at --, but then it treats everything else as a positional argument. So you can almost get what you want by having no positional arguments and then fetching the unmatched arguments, which returns a vector of the remaining arguments.
I have previously changed this code to specifically not modify argv at all, because it was causing a lot of people problems to have argv as non const, and they weren't expecting argv to change.
Maybe one small change that would suit your use case is to make the last matched argc accessible. Then you can just pass &argv[new_argc] to your second piece of code.

from cxxopts.

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.