Is there a way to invoke a default or fallback command, based on the args provided? As an example, consider a cli program for switching Ruby versions. switch_ruby ls
would list the available ruby versions, and switch_ruby use 3.0.1
would switch to that version. However, I’d like to make it so that switch_ruby
(with no args) would fallback to ls
, while switch_ruby 3.0.1
would use the use
command to switch to that version.
The docs didn’t have any examples like that, and poking at the source it didn’t seem possible. Is there a way to hack around this, or is it more trouble than its worth, and I should make a feature request?