vietjtnguyen / argagg

A simple C++11 command line argument parser
MIT License
224 stars 28 forks source link

Replace `fmt` program call with C++ code #21

Closed myint closed 3 years ago

myint commented 6 years ago

Here is the code I promised. It avoids callingfmt and works on macOS and Windows.

Note that I had to adjust the placement of "id" in the test case. "id" ought to fit fine at the end of the line within 75 columns. But fmt may have some other goal in mind.

Example:

$ ./bin/joinargs -h
Joins all positional arguments together with a separator

Usage: ./bin/joinargs [options] ARG [ARG...]

    -h, --help
        displays help information
    -v, --verbose
        increases verbosity
    --lorem-ipsum
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
        eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
        ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
        aliquip ex ea commodo consequat. Duis aute irure dolor in
        reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
        pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
        culpa qui officia deserunt mollit anim id est laborum.
    -s, --sep
        separator (default ',')
    -o, --output
        output filename (stdout if not specified)