Skip to content

fix(rtbtool): fix arg-parsing bugs and converge CLI with mvtbtool#557

Merged
petercorke merged 1 commit into
mainfrom
feat/rtbtool-cli-convergence
Jul 20, 2026
Merged

fix(rtbtool): fix arg-parsing bugs and converge CLI with mvtbtool#557
petercorke merged 1 commit into
mainfrom
feat/rtbtool-cli-convergence

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

  • Fixes two real argparse bugs in rtbtool: ArgumentParser("Robotics Toolbox shell") 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 with MVTB's mvtbtool (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 (mirrors MVTB_OPTIONS), and resolves short-flag collisions between the two tools (-r meant --resultprefix here but --run in mvtbtool; -b meant --no-banner here but --base in mvtbtool — --theme/-t and --prompt/-P also realigned to match).
  • 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 zero test coverage.

Test plan

  • rtbtool --help renders correctly with wrapped help text and defaults
  • pytest tests/test_bin.py -v — 5/5 passing
  • Manually verified --book, --theme, --resultprefix, --showassign, RTB_OPTIONS all still work
  • ruff check/ruff format clean on new/changed code (pre-existing lint debt in the star-import section left untouched, out of scope)

🤖 Generated with Claude Code

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>
@petercorke
petercorke merged commit b111856 into main Jul 20, 2026
16 checks passed
@petercorke
petercorke deleted the feat/rtbtool-cli-convergence branch July 20, 2026 08:45
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (298f4c0) to head (00f758f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/roboticstoolbox/bin/_bintools.py 0.00% 23 Missing ⚠️
src/roboticstoolbox/bin/rtbtool.py 0.00% 21 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot mentioned this pull request Jul 20, 2026
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.

1 participant