Group fallback not behaving as I expect
kdawgwilk opened this issue ยท 2 comments
I am working on a new project Autobahn and am using Console for the CLI tool ๐ I am wanting to define a default command that runs if no existing matches are found. So here is my setup:
let group = Group(id: executable, commands: [
Drive(console: terminal),
Init(console: terminal),
], help: [
"CLI for 'autobahn' - The swiftiest way to automate mundane developer tasks for your iOS apps",
], fallback: Drive(console: terminal))
try terminal.run(group, arguments: args)
This is the output for autobahn --help
:
Autobahn v0.1.0
Usage: autobahn command
CLI for 'autobahn' - The swiftiest way to automate mundane developer tasks for your iOS apps
Commands:
drive *Drive a specific highway
init Creates a default Autobahn.swift file
Use `autobahn command --help` for more information on a command.
And this is the output for autobahn drive --help
Autobahn v0.1.0
Usage: autobahn drive <highway> [--verbose]
*Drive a specific highway
Arugments:
highway The name of the highway you would like to drive
Options:
verbose Print more info to help debug issues
Now what I want to do is mark Drive as the default to I can just run autobahn <highway>
and have it run autobahn drive <highway>
behind the scenes. Basically I want to be able to pass arguments to the fallback command
thanks for reporting @kdawgwilk. I believe this is already fixed in 3.0 but I'm tagging this issue to make sure.
This limitation no longer exists in version 3. Groups work more similarly to commands now and you can execute arbitrary code when they are run.