-
Notifications
You must be signed in to change notification settings - Fork 124
Command support in REPL #1727
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
Merged
Command support in REPL #1727
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
afsalthaj
commented
Jun 1, 2025
afsalthaj
commented
Jun 1, 2025
afsalthaj
commented
Jun 1, 2025
afsalthaj
commented
Jun 2, 2025
jdegoes
approved these changes
Jun 3, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #1606
Commands in REPL. Implemented in a way golem-cli (or wasmtime) should be able to extend or override command set (as discussed during retreat)
There is an integration with
Clap
but note that golem_rib_repl's ownCommand
trait do not enforcing users to useClap
for parsing input.Adding new commands (and overriding)
Overriding built-in commands from golem-cli (if needed)
There is already
CommandRegistry::built_in()
.type-info
is part of built_in.These commands can be overriden by golem-cli (or wasmtime) if needed. Example: if
golem-cli
decides to override exports, it can create its own command and register and as far as the name matches golem-cli's export implementation will take precedence.Command name is the kebab case of the command type name. Just decided to do this, after I gave same name for two commands.
Currently supported commands
:
and keep clicking tabExamples:
Exports
TypeInfo
Clear
Command Error
If
clap::Parser
is used to implement theparse
function inCommand
above, help and error documents are automatically. It is upto the client what to use as a parser. Given golem-rib is going to be used in other runtimes soon, its better not to enforce clients who want to add new commands to depend onClap
as such.The inbuilt commands of golem-rib-repl are using clap for parse and documentations
Command Help
Other fix
It's a trade off after thinking and trying out a lot from a user perspective.
Just used record type for now - no other choice
instead of
Load and Unload commands can be supported as part of supporting multiple components properly. It will create more problems to expose these functionalities now, especially from golem-cli
REPL API changes
It breaks compatibility but it's a simple change. Add
None
for command-registry when creatingRibReplConfig