-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[Docs] [Qt] RPC-Console nested commands documentation #11698
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
Conversation
src/qt/rpcconsole.cpp
Outdated
| " example: getblockinfo(getblockhash(0),true).\n\n" | ||
|
|
||
| "Result values can be queried with a non-quoted string in brackets.\n" | ||
| " example: getblock(getblockhash(0) true)[height]\n\n" ))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add an example that uses access-by-index like getblock(getblockhash(0) true)[tx][0]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, should have included that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the use of "bracket" is correct, referring to the [].
|
Works as intended. |
|
I figured that it made sense (at least thematically 😅) for console help to be available from the inside the console, but that's basically just my personal preference. I'm guessing the subset of users interested in nested rpc commands are probably more command-line-centric that then the average user. Though a clickable link in the first bit of text might well be a better/cleaner solution. If kept as a command, I for sure think it should be added to the autocomplete list. I can add that in as well, I just didn't want to go overboard before getting some feedback. If implemented as a button/link, what should it reference/do? Pop a new window with text (like help > commands) in the file menu? |
|
Thanks for doing this! will test. |
Agree, I kind of like it as a command. An icon could be added later, but this is what I had in mind. Only have a few comments on the text. |
src/qt/rpcconsole.cpp
Outdated
| "This console accepts RPC commands using the standard syntax.\n" | ||
| " example: getblockhash 8\n\n" | ||
|
|
||
| "This console can also accept RPC commands using bracketed syntax.\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is parenthesized not bracketed syntax, I'd say?
src/qt/rpcconsole.cpp
Outdated
| "This console can also accept RPC commands using bracketed syntax.\n" | ||
| " example: getblockhash(8)\n\n" | ||
|
|
||
| "A space or a comma can be used to separate arguments for either syntax.\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "delimit" instead of "separate"?
src/qt/rpcconsole.cpp
Outdated
| " example: getblockinfo(getblockhash(0),true).\n\n" | ||
|
|
||
| "Result values can be queried with a non-quoted string in brackets.\n" | ||
| " example: getblock(getblockhash(0) true)[height]\n\n" ))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the use of "bracket" is correct, referring to the [].
src/qt/rpcconsole.cpp
Outdated
| message(CMD_REPLY, (tr("Welcome to the %1 RPC console.").arg(tr(PACKAGE_NAME)) + "<br>" + | ||
| tr("Use up and down arrows to navigate history, and %1 to clear screen.").arg("<b>"+clsKey+"</b>") + "<br>" + | ||
| tr("Type <b>help</b> for an overview of available commands.")) + | ||
| tr("Type <b>help</b> for an overview of available commands.<br>") + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the <br> out of the translation message, as it frequently gets lost by translators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree with all of this.
|
I have the autocomplete working and will make the suggested changes to the help text. I'll push a revision today or tomorrow. Thanks for the input guys! |
|
Thanks! Looks good! |
3e01cd6 to
5305dda
Compare
|
squished |
|
utACK 5305dda. |
|
utACK 5305dda4c3f2d0b9d6a1bf9d5c4cc1c6215ed475 |
meshcollider
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 5305dda
Commit message needs modification though, perhaps "Add help-console command to Qt debug console" or something
src/qt/rpcconsole.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too sure about calling them "numeric result objects", numeric just sounds like it's a type of number, rather than an unnamed list/array or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good point. You think changing those last 2 lines to just "Results can be queried with..." is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change that last bit and resquash with a better commit message.
50caa21 to
81fe3fc
Compare
- Added `help-console` to the list of autocompletion strings
- Implemented requested changes to help message:
- Added an example that uses access-by-index `getblock(getblockhash(0) true)[tx][0]`
- Replace "bracketed syntax" to "parenthesized syntax" where applicable
- Replace "separate" with "delimit"
- Removed `<br>` and `<b>help/help-console</b>` from translation strings, since these parts don't change between languages
- Changed examples to be based off `getblock 0` so they will work even with pruned/no blockchain and `disablewallet` if copied and pasted
- Clarified syntax for queries of named/unnamed result objects.
81fe3fc to
c3055bb
Compare
|
re-utACK c3055bb |
c3055bb Add help-console command to Qt debug console (Luke Mlsna) Pull request description: This PR would close issue #9195 by adding documentation for the debug console features (mainly nested commands) which were added in [PR #7783](#7783). The following changes were made to QT debug console code: - Added a line to the initial message text at the top of the debug console: > For more information on using this console type **help-console**. - Added a pseudo-command `help-console` which is hooked after parsing the request, but before actually executing the RPC thread. It prints the following text to the console as if it were a valid RPC response. > This console accepts RPC commands using the standard syntax. > example: getblockhash 8 > This console can also accept RPC commands using bracketed syntax. > example: getblockhash(8) > A space or a comma can be used to separate arguments for either syntax. > example: sendtoaddress \<address\> \<amount\> > sendtoaddress,\<address\>,\<amount\> > Commands may be nested when specified with the bracketed syntax. > example: getblockinfo(getblockhash(0),true). > Result values can be queried with a non-quoted string in brackets. > example: getblock(getblockhash(0) true)[height] This seemed like a reasonably sane way to introduce a fake RPC help command, but Tree-SHA512: 35d73dcef9c4936b8be99e80978169f117c22b94f4400c91097bf7e0e1489060202dcd738d9debdf4c8a7bd10709e2c19d4f625f19e47c4a034f1d6019c0e0f2
maflcko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post merge ACK c3055bb
| std::string executableCommand = command.toStdString() + "\n"; | ||
|
|
||
| // Catch the console-only-help command before RPC call is executed and reply with help text as-if a RPC reply. | ||
| if(executableCommand == "help-console\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Should use .starts_with("help-console") to ignore trailing white space. Though, can wait, since that seems to be part of cpp20
Edit: Could use QString::fromStdString(executableCommand).startsWith("help-console")
…ation c3055bb Add help-console command to Qt debug console (Luke Mlsna) Pull request description: This PR would close issue bitcoin#9195 by adding documentation for the debug console features (mainly nested commands) which were added in [PR bitcoin#7783](bitcoin#7783). The following changes were made to QT debug console code: - Added a line to the initial message text at the top of the debug console: > For more information on using this console type **help-console**. - Added a pseudo-command `help-console` which is hooked after parsing the request, but before actually executing the RPC thread. It prints the following text to the console as if it were a valid RPC response. > This console accepts RPC commands using the standard syntax. > example: getblockhash 8 > This console can also accept RPC commands using bracketed syntax. > example: getblockhash(8) > A space or a comma can be used to separate arguments for either syntax. > example: sendtoaddress \<address\> \<amount\> > sendtoaddress,\<address\>,\<amount\> > Commands may be nested when specified with the bracketed syntax. > example: getblockinfo(getblockhash(0),true). > Result values can be queried with a non-quoted string in brackets. > example: getblock(getblockhash(0) true)[height] This seemed like a reasonably sane way to introduce a fake RPC help command, but Tree-SHA512: 35d73dcef9c4936b8be99e80978169f117c22b94f4400c91097bf7e0e1489060202dcd738d9debdf4c8a7bd10709e2c19d4f625f19e47c4a034f1d6019c0e0f2
d8fe6bf [Doc] Add new GUI RPC-console syntax to release notes (random-zebra) eced57b Add help-console command to Qt debug console (Luke Mlsna) Pull request description: Follow up to #2282 First commit backports bitcoin#11698, adding: - a line to the initial message text at the top of the debug console - a pseudo-command `help-console` which is hooked after parsing the request, but before executing the RPC thread Second commit updates the release notes. ACKs for top commit: furszy: utACK d8fe6bf Fuzzbawls: ACK d8fe6bf Tree-SHA512: df415a27acb587535dfdc8775bacb231d435566bdfb18ea71863212999cf78d139b9b1eaceead5c573ace5203416d2f9392f9179ccd56b3eda1e2ab9fc3ad772
This PR would close issue #9195 by adding documentation for the debug console features (mainly nested commands) which were added in PR #7783.
The following changes were made to QT debug console code:
help-consolewhich is hooked after parsing the request, but before actually executing the RPC thread. It prints the following text to the console as if it were a valid RPC response.This seemed like a reasonably sane way to introduce a fake RPC help command, but