Reasonable samples:
touch cache.c
bat cache.c
bat -- cache.c
touch scratch.text
bat scratch.text
bat -- scratch.text
Unexpected output for all four examples:
error: The subcommand 'scratch.text' wasn't recognized
Did you mean 'cache'?
If you believe you received this message in error, try re-running with 'bat -- scratch.text'
USAGE:
bat [OPTIONS] [FILE]...
bat <SUBCOMMAND>
For more information try --help
Behavior I expect as a user:
bat -- scratch.text should workbat shouldn't suggest a sub-command when a file existsTwo more I want as a user:
bat <tab> vs bat --<tab>What do you think? I'd be happy to open a couple PRs this weekend on whatever is decided.
I can't confirm this bug on my computer setup (macOS, bat v0.12.1).
What platform are you using?
What's the output when you run bat --version?
Running the suggestion bat -- scratch.text should work
We've had issues with mixing positional arguments (files) with subcommands in the past (#245 #557 #584). It should have been fixed with the latest release, though.
Sub-commands should be implemented as flags to keep the CLI interface clean. I want to easily autocomplete commands and options separate from files. bat
vs bat --
There have been a few discussions in #557 about renaming bat --cache to a flag or separate binary, but I believe they've been put on pause since subcommands were fixed in v0.12.1.
No "Did you mean..." messages. I like the feature in a compiler, not so much on the command line. Why? 1) These are power tools--I can diagnose an clear error myself. 2) Overly verbose messages eat up terminal space.
I believe that's a feature of clap, the crate that bat uses for command line argument parsing. I think it's possible to disable it. That would need to be up for discussion, though.
I'm on macOS v0.12.1 now and cannot reproduce either. I'll check the version of my home Linux install tonight.
I'm going to close this for now. Let us know if you can reproduce the bug on v0.12.1.
Tested 0.12.1 on Linux, bug fixed. Sorry for the delay. Love the program :+1:
Most helpful comment
I'm on macOS v0.12.1 now and cannot reproduce either. I'll check the version of my home Linux install tonight.