Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Dec 18, 2020

This not only moves the parsing responsibility out from the wallet tool, but it also makes it easier to implement bitcoin-util #19937

Fixes: #20902

@maflcko maflcko force-pushed the 2012-argsCmd branch 2 times, most recently from faeba84 to fa6cd35 Compare December 18, 2020 14:14
@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 18, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@practicalswift
Copy link
Contributor

Concept ACK

Copy link
Contributor

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

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

Concept ACK

@ajtowns ajtowns mentioned this pull request Jan 12, 2021
@maflcko maflcko changed the title util: Add ArgsManager::GetCommands() and use it in bitcoin-wallet util: Add ArgsManager::GetCommand() and use it in bitcoin-wallet Jan 13, 2021
@DrahtBot
Copy link
Contributor

🕵️ @jonatack has been requested to review this pull request as specified in the REVIEWERS file.

Copy link
Contributor

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

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

ACK fad369f

Looks good; comments are just ideas for consideration. Patch for bitcoin-util at https://github.com/ajtowns/bitcoin/commits/202101-util-addcmd

Copy link
Contributor

@fjahr fjahr left a comment

Choose a reason for hiding this comment

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

Code review ACK fad369f

This works, however I liked @ajtowns comments and I think consistency whether method or command is used would be good. It seems method is getting replaced by command, is that a general naming scheme change?

@laanwj
Copy link
Member

laanwj commented Jan 20, 2021

Concept ACK

Copy link
Contributor

@fjahr fjahr left a comment

Choose a reason for hiding this comment

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

Code review ACK fa61b9d

Feel free to ignore my nits.

@@ -188,6 +188,8 @@ def test_invalid_tool_commands_and_args(self):
self.assert_raises_tool_error('Invalid command: help', 'help')
self.assert_raises_tool_error('Error: two methods provided (info and create). Only one method should be provided.', 'info', 'create')
self.assert_raises_tool_error('Error parsing command line arguments: Invalid parameter -foo', '-foo')
self.assert_raises_tool_error('No method provided. Run `bitcoin-wallet -help` for valid methods.')
Copy link
Contributor

Choose a reason for hiding this comment

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

in fa06bce:

nit: Commit message could have been a bit more descriptive ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, will change on the next push

@@ -248,6 +251,20 @@ class ArgsManager
*/
const std::list<SectionInfo> GetUnrecognizedSections() const;

struct Command {
Copy link
Contributor

Choose a reason for hiding this comment

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

in fa61b9d:

nit: seeing this now I think I would have named it CommandCall or something similar to express that it's command + args. But feel free to ignore my name bikeshedding.

Copy link
Member Author

Choose a reason for hiding this comment

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

#20715 (comment) names it CmdArg. So I could call it CommandArg or CommandArgs (because there might be multiple args to the command). Not sure what to do here, but I think I'll leave this as is for now and let the naming committee determine a suitable name and let them change it after merge.

@ajtowns
Copy link
Contributor

ajtowns commented Feb 4, 2021

ACK fa61b9d

Looks good to me, though the third commit has a typo in the description: "dependend". Updated https://github.com/ajtowns/bitcoin/commits/202101-util-addcmd

@maflcko maflcko merged commit 4e946eb into bitcoin:master Feb 4, 2021
@maflcko
Copy link
Member Author

maflcko commented Feb 4, 2021

third commit has a typo in the description: "dependend".

Good catch. Though, I'll leave this as-is to minimize the re-review backlog.

@maflcko maflcko deleted the 2012-argsCmd branch February 4, 2021 08:13
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 4, 2021
@ajtowns ajtowns mentioned this pull request Feb 6, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wallet tool silently ignores trailing options
6 participants