parse_config_file: alternate comment interpretation

Open
#100 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
cli

Research direction

Start by locating the parse_config_file implementation and its existing tests or documentation. Review how # is currently interpreted, then determine how an opt-in setting should treat # in column 0 or after whitespace while preserving # in values. Done means the requested setting is documented and covered by tests for both comment and value cases.

Written by the indexing model from the issue text.

Description

For some time parse_config_file treats all # signs as initiating comments, preventing the use of # signs in values.

It would be very helpful if a simple flag could be set, to only consider # signs in column 0, or preceded only by whitespace, as comments. This would make for clearer, cleaner code and configuration files, when configuration values contain #.

Here's an example of somebody looking for this, and being advised to write an iostreams filter to make it work:
https://stackoverflow.com/questions/31921241/boostprogram-options-how-to-support-hash-character-in-a-value

Here's an example of brute-force key generation implemented in a production release, to make sure the key never contains the # symbol and can be stored in the configuration file:
https://github.com/libbitcoin/libbitcoin-protocol/blob/version3/src/zmq/certificate.cpp#L78

Dominant language
C++
Stars
136
Forks
117
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/program_options

All issues in boostorg/program_options

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.