1 min read 1 like
A mistyped fly subcommand now fails clearly instead of printing help
Vincent Charlebois
You might not like to see errors in your command output, but agents need them to correct their course and succeed. Non-existent subcommands now return an error, just like non-existent commands already did. The error suggests the command you probably meant when there’s a close match.
In this post, I use bogus as an example of a command that doesn’t exist. fly bogus already returned a clear error, but unknown subcommands didn’t. Running fly apps bogus, fly machine bogus, fly mpg bogus or fly volumes bogus printed the help and exited 0, as if the command succeeded.
This meant a typo could be mistaken for a success. For example, a script that ran fly apps lst > apps.txt instead of fly apps list > apps.txt would get a file of help text without any error message.
Since flyctl v0.5.9, non-existent subcommands print an error to stderr and the command exits 1:
$ fly apps lst; echo $?
Error: unknown command "lst" for "flyctl apps"
Did you mean this?
list
Run 'flyctl apps --help' for usage.
1
fly apps, fly apps --help and fly help apps still print help and exit 0. fly apps bogus --help also prints the group’s help and exits 0, because the --help flag is prioritized.
There are some exceptions: a few commands, like fly version, still ignore the extra word. For example, fly version bogus prints the version and exits 0.
If you, your agent or one of your scripts has a mistyped subcommand in it, it will start failing with an error once you’re on flyctl v0.5.9 or later.
Tell us if this broke any of your workflows or if there are any other inconsistencies you’d like to see fixed in future versions of flyctl.