HomePhabricator

util: Make ArgsManager::GetPathArg more widely usable

Description

util: Make ArgsManager::GetPathArg more widely usable

Summary:

util: Add GetPathArg default path argument

Let GetPathArg method be used more places for path arguments that have
default values, like "-settings" and BITCOIN_SETTINGS_FILENAME in the
next commit.

Also:

  • Fix negated argument handling. Return path{} not path{"0"} when path argument is negated.
  • Add new tests for default and negated cases
  • Move GetPathArg() method declaration next to GetArg() declarations. The two methods are close substitutes for each other, so this should help keep them consistent and make them more discoverable.

util, refactor: Use GetPathArg to read "-settings" value

Take advantage of GetPathArg to simplify code slightly.

The change to check-doc is necessary for linting.

Use GetPathArg where possible

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

This is a backport of core#24306

Depends on D15063

Test Plan: ninja all check-all bench-bitcoin

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: bytesofman

Differential Revision: https://reviews.bitcoinabc.org/D15064

Details

Provenance
Ryan Ofsky <ryan@ofsky.org>Authored on Feb 9 2022, 22:49
PiRKCommitted on Jan 4 2024, 14:05
PiRKPushed on Jan 4 2024, 14:05
Reviewer
Restricted Project
Differential Revision
D15064: util: Make ArgsManager::GetPathArg more widely usable
Parents
rABCaf2a781f5087: bench: Represents paths with fs::path instead of std::string
Branches
Unknown
Tags
Unknown