fix(rtbtool): fix arg-parsing bugs and converge CLI with mvtbtool#557
Merged
Conversation
Fixes two real bugs: ArgumentParser("...") was setting prog instead of
description, and --confirmexit/-x lacked action="store_true" so it
demanded a value argument instead of behaving as a flag.
Converges rtbtool's CLI conventions with MVTB's mvtbtool, which is the
more deliberately-designed sibling tool: adds a shared _bintools.py
(line-wrapping/defaults help formatter, RTB_LINK), an RTB_OPTIONS env
var for default options, and resolves short-flag collisions between
the two tools (-r meant --resultprefix here but --run there; -b meant
--no-banner here but --base there). Also replaces the sys.argv
mutation trick with explicitly passing argv= to IPython.start_ipython,
matching mvtbtool's approach.
Adds tests/test_bin.py smoke tests (--help, startup-to-prompt via
closed stdin, script execution, RTB_OPTIONS), mirroring MVTB's
tests/test_bin.py — rtbtool previously had no test coverage at all.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #557 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 141 142 +1
Lines 13659 13694 +35
=====================================
- Misses 13659 13694 +35 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
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.
Summary
rtbtool:ArgumentParser("Robotics Toolbox shell")was settingproginstead ofdescription, and--confirmexit/-xlackedaction="store_true"so it demanded a value argument instead of behaving as a flag.rtbtool's CLI with MVTB'smvtbtool(the more deliberately-designed sibling tool): adds a shared_bintools.py(line-wrapping/defaults help formatter,RTB_LINK), anRTB_OPTIONSenv var for default options (mirrorsMVTB_OPTIONS), and resolves short-flag collisions between the two tools (-rmeant--resultprefixhere but--runin mvtbtool;-bmeant--no-bannerhere but--basein mvtbtool —--theme/-tand--prompt/-Palso realigned to match).sys.argvmutation trick with explicitly passingargv=toIPython.start_ipython, matching mvtbtool's approach.tests/test_bin.pysmoke tests (--help, startup-to-prompt via closed stdin, script execution,RTB_OPTIONS), mirroring MVTB'stests/test_bin.py.rtbtoolpreviously had zero test coverage.Test plan
rtbtool --helprenders correctly with wrapped help text and defaultspytest tests/test_bin.py -v— 5/5 passing--book,--theme,--resultprefix,--showassign,RTB_OPTIONSall still workruff check/ruff formatclean on new/changed code (pre-existing lint debt in the star-import section left untouched, out of scope)🤖 Generated with Claude Code