Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Arg parsing overhaul #1938

Merged
merged 20 commits into from
Oct 28, 2020
Merged

Conversation

Fuzzbawls
Copy link
Collaborator

This is a cumulation of several upstream backports surrounding the argument parsing code.

Included here are the following upstream PRs:

I've also refactored the global logging argument parsing to match, as that was an "out-of-order" PR that was previously backported to match our previous state.

Fuzzbawls and others added 20 commits October 21, 2020 19:56
Swap mapMultiArgs for a const-reference to a _mapMultiArgs which is
only accessed in util.cpp
- Introduce ArgsManager::GetArgs()
- Adapt util_tests.cpp to ArgsManager
-BEGIN VERIFY SCRIPT-
sed -i 's/mapMultiArgs.count(/gArgs.IsArgSet(/g' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i 's/mapMultiArgs.at("/gArgs.GetArgs("/g' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
- Set ArgsManager::mapMultiArgs in ArgsManager::SoftSetArg, ForceSetArg, SoftSetBoolArg
- Don't check gArgs.IsArgSet() is greater than 0
- Remove unneeded calls and local variables
Return empty std::vector<std::string> with ArgsManager::GetArgs if
nothing is set for that string
This is meant to be an intermediate commit to prove that the next does not
introduce any changes in the semantics of boolean option parsing
This commit adds tracking for negated arguments. This change will be used in a
future commit that allows disabling the debug.log file using -nodebuglogfile.
Not directly from upstream due to the global logging vars being
backported prior to the previous commits in this branch.
They were temporary additions to ease the transition.

-BEGIN VERIFY SCRIPT-
find src/ -name "*.cpp" ! -wholename "src/util.h" ! -wholename "src/util.cpp" | xargs perl -i -pe 's/(?<!\.)(ParseParameters|ReadConfigFile|IsArgSet|(Soft|Force)?(Get|Set)(|Bool|)Arg(s)?)\(/gArgs.\1(/g'
-END VERIFY SCRIPT-
extension of the previous scripted-diff commit
@Fuzzbawls Fuzzbawls added Upstream Startup Wallet startup changes and/or improvements Util / log / libs labels Oct 23, 2020
@Fuzzbawls Fuzzbawls added this to the 5.0.0 milestone Oct 23, 2020
@Fuzzbawls Fuzzbawls self-assigned this Oct 23, 2020
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 4709ff8

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool encapsulation, utACK 4709ff8 and merging

@furszy furszy merged commit de5b240 into PIVX-Project:master Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Startup Wallet startup changes and/or improvements Upstream Util / log / libs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants