sirraide / clopts Goto Github PK
View Code? Open in Web Editor NEWType-safe, compile-time header-only command line options library for C++20
License: MIT License
Type-safe, compile-time header-only command line options library for C++20
License: MIT License
We already sort of support short options, but the way they work is pretty limited atm. Finishing implementing short options entails:
-la
in ls -la
).-xvf
in tar -xvf ...
. This option must come last (e.g. tar -fvx
is not valid), and as a consequence, it need not be separated from its argument by whitespace.--
should stop parsing.multiple<short_option<...>>
does not seem to work at the moment.Something like:
unknown_error // default, obviously
unknown_warn
unknown_ignore
Implement this as a type that stores an enumerator; we could expose the enumerator, but that would mean 1. more things to check, and 2. unknown<unknown_mode::error>
is too verbose, and unknown<error>
is just namespace pollution, so there’s no particularly good way of doing that...
Basically, it would be nice to have a feature that lets us attach tags to something, similarly to how the -x
option works in Clang:
tag<"-x", "Set the file type", std::string>,
positional<"files", "The files to compile", tagged<std::string, "-x">,
Example:
foo -x t1 bar baz -x t2 quux foobar
Content of "files"
:
{"foo", ""},
{"bar", "t1"},
{"baz", "t1"},
{"quux", "t2"},
{"foobar", "t2"},
Allow any type satisfying std::integral
or std::floating_point
as option types.
VLC’s --help
and -H
printouts look pretty nice; perhaps we could ‘take inspiration’ from that. This would entail:
colo(u)rs<...>
type. Also add some default themes because why not.help<>
) that adds a --colo(u)r
option that allows users to disable/enable colours from the command line. This should probably passed in together with the colour configuration. It would probably be a good idea if all of the colour configuration is handled via the colo(u)rs<...>
type, possibly w/ subtypes.isatty()
to determine whether or not to print colours.Probably after the usage line and before ‘OPTIONS’.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.