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

feat: Add help command and help definitions #192

Merged
merged 1 commit into from Jul 7, 2021

Conversation

emizzle
Copy link

@emizzle emizzle commented Jul 1, 2021

Closes #189.

imgur

Add support for the /help command, which dynamically builds a list of help commands based on the help() procs defined for each command type, ie Login.

The help proc returns a type of HelpText, which contains all the information necessary to render help information for that command. It contains the command, parameters (each parameters contains a name and description), aliases, and a description.

The help text is generated (at compile time) by a macro called buildCommandHelp(). Once the /help command is executed, the output of buildCommandHelp() is passed to the task runner so that a HelpResult event can be created and the help text can be displayed on screen. Because the text is generated at compile time, it is not necessary to pass this text through the task runner, and is displayed directly on screen in the main thread.

NOTES

  1. The help text is quite long, especially given there are blank spaces in between each command. This would require the chat client to be able to scroll unless it is sufficiently tall.
  2. I am not married to the display output at all, even after experimenting with a few different layouts. There is some leftover rendering code in the HelpResult action which allows for the the command description to be written on the same line as the command name and keep the description spaced in line with all other descriptions, but it didn’t appear as readable as the format that I settled on in the end. I left it in there in case we wanted to change up how help is rendered.
  3. I didn't want to spend too much time on the "blank" part of the /, /send command. I figured if there were strong objections to overall layout/rendering, then that may change anyway. But it's definitely possible to remove or change. The /, /send has been replaced with /send (visible in the first command shown in the screenshot above).
  4. Keeping this as a draft for now for two reasons:
  • the base branch (login/logout) is not complete yet
  • the PR can serve as a place to get any feedback on the result

@emizzle emizzle force-pushed the feat/example-client/help-command branch 2 times, most recently from 8650dc2 to 9ee4dd0 Compare July 2, 2021 00:12
@emizzle emizzle marked this pull request as ready for review July 2, 2021 00:15
@emizzle emizzle marked this pull request as draft July 2, 2021 00:17
@emizzle emizzle force-pushed the feat/example-client/help-command branch from 9ee4dd0 to b6b1424 Compare July 2, 2021 00:21
@michaelsbradleyjr michaelsbradleyjr force-pushed the feat/example-client/login-logout branch 2 times, most recently from b2b5aa5 to d3c013d Compare July 6, 2021 19:17
@emizzle emizzle marked this pull request as ready for review July 6, 2021 22:54
@michaelsbradleyjr michaelsbradleyjr force-pushed the feat/example-client/login-logout branch 2 times, most recently from f1e782f to aa67f67 Compare July 7, 2021 03:23
Base automatically changed from feat/example-client/login-logout to master July 7, 2021 06:23
Add support for the `/help` command, which dynamically builds a list of help commands based on the `help()` procs defined for each command type, ie `Login`.

The `help` proc returns a type of `HelpText`, which contains all the information necessary to render help information for that command. It contains the command, parameters (each parameters contains a name and description), aliases, and a description.

The help text is generated (at compile time) by a macro called `buildCommandHelp()`. Once the `/help` command is executed, the output of `buildCommandHelp()` is passed to the task runner so that a `HelpResult` event can be created and the help text can be displayed on screen. Because the text is generated at compile time, it is not necessary to pass this text through the task runner, and is displayed directly on screen in the main thread.

## NOTES
1. The help text is quite long, especially given there are blank spaces in between each command. This would require the chat client to be able to scroll unless it is sufficiently tall.
2. I am not married to the display output at all, even after experimenting with a few different layouts. There is some leftover rendering code in the `HelpResult` action which allows for the the command description to be written on the same line as the command name and keep the description spaced in line with all other descriptions, but it didn’t appear as readable as the format that I settled on in the end. I left it in there in case we wanted to change up how help is rendered.
@emizzle emizzle force-pushed the feat/example-client/help-command branch from b6b1424 to 8ade21f Compare July 7, 2021 07:46
@emizzle emizzle merged commit 4fc6d76 into master Jul 7, 2021
@michaelsbradleyjr michaelsbradleyjr deleted the feat/example-client/help-command branch July 15, 2021 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create help task and event to display help on screen
1 participant