Add interactive CLI and refactor tbots.py#3657
Add interactive CLI and refactor tbots.py#3657StarrryNight wants to merge 19 commits intoUBC-Thunderbots:masterfrom
Conversation
| test = "all" if not test else test | ||
| args.extend(["test", "--suite" if test == "all" else test]) |
There was a problem hiding this comment.
nit: just straight up use if not test instead of setting to "all" then checking again
1ceb59e to
bdea7c6
Compare
|
@StarrryNight Is this ready for review? |
sauravbanna
left a comment
There was a problem hiding this comment.
changes look great ! sorry for long ass comment but i think would be cleaner
| ], | ||
| ).ask() | ||
| if "enable_autoref" in options: | ||
| args.append("--enable_autoref") |
There was a problem hiding this comment.
might be a bit hard to explain, but i think combining typer and questionary here is a bit overkill. this is the flow right now:
- define Options in typer, with the flags as strings (eg: "--enable_autoref")
- check for the questionary choices
if "flag" in options - based on choices create a list of raw strings again (not using the typer options yet)
- convert strings to Typer options
- Call main() -> convert typer options to BuildOptions
- do our own validation and create the command
i don't really see what the point of converting from questionary choices -> strings -> typer options -> BuildOptions is.
we can instead directly go from questionary choices -> BuildOptions.
we can make BuildOptions use the Builder pattern. start with empty options, and append new options as the user chooses them in the cli. then pass the whole options to main
build_options = BuildOptions()
...
options = questionary.checkbox(...)
build_options = build_options.set_autoref("enable_autoref" in options)
...
we can then extract this from main()
validate(opts)
command = create_command(ctx, opts)
...
into its own helper. so the flow would be:
- call
main()(entry point) - if no args
- call interactive cli -> create BuildOptions
- call helper with BuildOptions to validate + create + run command
- if args:
- create BuildOptions from args (like we do right now)
- call helper with build options
| if "record_stats" in options: | ||
| args.append("--record_stats") |
41fcbd0 to
485887c
Compare
|
@StarrryNight specifying --record_stats does not work: |
ad304db to
afe8b64
Compare
Description
Note: commit history is cooked because I had to recommit everything together. Full commit history here: #3656
This ticket resolves #3623.
Screencast.from.2026-03-21.13-16-09.mp4
Testing Done
Interactive cli works, tbots.py works.
Resolved Issues
#3623
Length Justification and Key Files to Review
Review Checklist
It is the reviewers responsibility to also make sure every item here has been covered
.hfile) should have a javadoc style comment at the start of them. For examples, see the functions defined inthunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.TODO(or similar) statements should either be completed or associated with a github issue