Skip to content

fix(cli): fix Thor::UndefinedCommandError argument count#5

Merged
dpaluy merged 1 commit intomasterfrom
fix/exe
Nov 22, 2025
Merged

fix(cli): fix Thor::UndefinedCommandError argument count#5
dpaluy merged 1 commit intomasterfrom
fix/exe

Conversation

@dpaluy
Copy link
Copy Markdown
Owner

@dpaluy dpaluy commented Nov 22, 2025

Summary

  • Fixed Thor::UndefinedCommandError to pass correct 3 arguments (command, nil, all_commands.keys)
  • Resolves "wrong number of arguments (given 1, expected 3)" error that prevented asdf from creating the railstart shim
  • Version bumped to 0.2.1 with CHANGELOG update

Problem

When Thor tried to handle help commands or undefined commands, it would raise Thor::UndefinedCommandError with only the command string as argument. However, the Thor exception constructor expects exactly 3 arguments: the command name, nil, and a list of valid commands. This caused a crash that prevented asdf from properly creating the railstart executable shim.

Solution

Updated the exception instantiation in lib/railstart/cli.rb line 74 to provide all required arguments:

raise Thor::UndefinedCommandError.new(command, nil, self.class.all_commands.keys)

Files Changed

  • lib/railstart/cli.rb: Fixed exception argument signature in CLI#help method
  • lib/railstart/version.rb: Bumped version to 0.2.1
  • CHANGELOG.md: Added entry documenting the fix

Test plan

  • RuboCop linting passes (no offenses detected)
  • Manual testing: railstart commands execute without exception errors
  • Verified commit message follows conventional commits format
  • CHANGELOG properly updated with fix documentation

Notes

This is a critical fix for the gem's executability - without this, asdf cannot properly integrate the railstart command shim.

The Thor::UndefinedCommandError exception requires 3 arguments:
command, nil, and list of valid commands. Previously passing only
the command string caused "wrong number of arguments (given 1, expected 3)"
error that prevented asdf from creating the railstart shim.

Changes:
- Updated CLI#help to instantiate exception with correct signature
- Version bumped to 0.2.1
- CHANGELOG.md updated with fix documentation
@dpaluy dpaluy merged commit 5fe2425 into master Nov 22, 2025
1 check passed
@dpaluy dpaluy deleted the fix/exe branch November 22, 2025 22:58
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