Coder Social home page Coder Social logo

cpputil's People

Contributors

bchurchill avatar eschkufz avatar stefanheule avatar

Stargazers

 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  avatar  avatar  avatar  avatar

cpputil's Issues

override argument

Add an argument type that functions like a flag and overrides the value of another argument. This way, overrides will print with the --debug_args flag.

undefined read when iterating bits of bitstring

I'm going through the valgrind memcheck output, looking for the culprit of my bug. I don't think this is the real culprit, but there are a few places that the bit iterator for bitstring performs an undefined read. I think I know how to fix this and will do so in a moment.

Generalize io/fail.h to warnings

io/fail.h adds an error string and methods for managing the failbit in a stream.

Generalize this feature to a warning bit and a list of warning messages.

License?

What license is this repository under?

Add support for explaining parse errors in CommandLine

The primary mechanism for communicating parse errors to the CommandLine library is to set the failbit in an iostream. This is nice because it allows for the use of built-in parsers and doesn't require any code bloat for people writing their own parsers. All you do is implement a functor and you're done.

The downside is that the generic parse error message that gets printed is rather cryptic. It would be nice to be able to store not just the fail bit in an iostream, but also an error message. We can do this pretty easily with xalloc and pword.

command line

String parsing doesn't work correctly when reading from config files.

Add support for required arguments

I would like to implement support for required arguments. If one or more required arguments aren't passed via the command line, then an error message is shown and the system exits with status 1. The implementation would add a "required" method, that can be chained just like other methods to set properties or arguments. For instance, one could have

FileArg<TUnit, TUnitReader, TUnitWriter>& target_arg =
  FileArg<TUnit, TUnitReader, TUnitWriter>::create("target")
  .usage("<path/to/file.s>")
  .description("Target code")
  .required();

Thoughts, objections? In STOKE, there are a bunch of arguments that are clearly mandatory, but no error is given if they aren't provided. This feature in cpputils would allow us to improve that situation.

Should we stop sorting arguments?

At the moment, command line arguments are sorted alphabetically. However, often times developers (e.g. in STOKE) will write out arguments in a natural way, and sorting them alphabetically destroys that order.

Should we make sorting at least optional (and maybe default to false)? Or is there a reason for sorting them alphabetically that I don't see?

Print default value with --help

It would be very valuable if we printed the default value with arguments when showing the help. This would make it much easier to use certain tools.

Now, some default arguments may be hard to print (e.g. because the take many lines). We could have a best-effort implementation, that shows the default for all the arguments which can be printed in one line, say. In practice, this would cover most arguments, and the remaining defaults could still be viewed using --debug_args with some additional effort.

Thoughts? I would volunteer to implement this.

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.