-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add global command to the debugger #142
base: main
Are you sure you want to change the base?
Conversation
src/debugger.rs
Outdated
format!( | ||
"{} global properties registered:\n{}", | ||
properties.len(), | ||
properties.join(", ") |
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.
What is going to happen when this is super-long? Are you just relying on the console wrapping?
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 switched this to newline
properties.join(", ") | ||
) | ||
} | ||
impl DebuggerCommand for GlobalPropertyCommand { |
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.
So what is your plan for the syntax for global set?
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'd still like to understand this point.
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 added a document with some ideas about this
"{} global properties registered:", | ||
context.list_registered_global_properties().len() | ||
); | ||
assert!(output.into_string().contains(&expected)); |
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.
Is there a reason for .contains()
rather than equals?
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.
It's sort of hard to know what all the registered global properties actually are in tests; I switched the other contains though
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.
Still need to review the code, but left some comments on the doc.
of a primary command, subcommands, and arguments: | ||
|
||
``` | ||
<primary_command> [<subcommand>] [<positional_argument>] [--<argument> [<value>]] |
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.
Don't positional arguments usually come after named arguments?
- `<primary_command>` is the top-level command category (e.g., `breakpoint`, `global`, `query`, `people`). | ||
- `[<subcommand>]` specifies an action to perform (e.g., `set`, `get`, `list`, `delete`). | ||
- `[<positional_argument>]` may be used to provide necessary inputs (e.g., the name of a property) | ||
- `[--<argument> [<value>]]` represents named options that modify behavior, or provide additional inputs |
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.
Not --argument=value
|
||
Set a breakpoint at the specified time. | ||
|
||
Example: `breakpoint set --time 4.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.
What could there be besides time here?
|
||
Set the specified global variable to a value. | ||
|
||
Example: `global set ixa.Foo=42` |
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 a good syntax but is it going to challenge clap?
|
||
List all global variables with the specified prefix. | ||
|
||
Example: `global list --prefix ixa.` |
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.
Nice one.
|
||
Example: `people set --id 42 --property Region=CA` | ||
|
||
- **`people add [--properties Region=CA]`** |
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.
Why do you need --properties
here. What else could be there?
|
||
|
||
### 4. Queries | ||
Commands for creating pre-saved queries of people by property-value pairs. |
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.
Do you think we should call these people query
|
||
- **`query get <id>`** | ||
|
||
Retrieve a query by identifier |
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 just prints it out?
This PR adds a
global
command to the debugger, which prints the value of a registered global property to the console.If you type
global
(with no argument) or with an invalid property name, you will see a list of available properties:If you provide a valid, fully qualified property name, you will see the value: