-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
command line's 'help' could be more helpful #1088
Comments
Just as a comparison, I've run I'm not so sure I'd like to see the help if I type an unrecognized command as I could just had a typo and the help information would "pollute" the terminal. I agree with recognizing |
|
Also there's already #531 to track supporting |
Agreed, and this has annoyed me since day one, especially the non-Unixy approach to CLI argument syntax of Commandant, which is the library we use to handle this. Fixing this upstream in Commandant would be ideal, but moving entirely away from the verb-based syntax would be unfortunate since it would break so much existing usage. |
Does #531 suggest that I can type
and get the same results as if I'd typed |
I don't think that was mentioned there, but I think #531 is similar to your second point (not the first). |
@marcelofabri, I agree with you, #531 is a more detailed description of what I might have meant by 'recognized as valid' |
Not only that, but in the absence of a proper man page, it would also be helpful if the 'help' command would display ALL possible arguments as well. Better overdo it, like nmap, than hold back information, is my motto. |
Thank you @axello, I was looking all over trying to find out how to include the config path when using the command line interface. And ironically the only place I found that mentions it is your comment on this dead issue about how bad documentation is... |
This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions! |
Does SwiftLint already use Swift Argument Parser? If not, moving to it would probably satisfy much of this "for free." |
No we use Commandant (same as Carthage), but I’ve been considering switching over to Swift Argument Parser. Other than the work involved to migrate, we should also assess the impact to existing users, if it’s possible to keep the current command syntax working, etc. |
We've migrated to swift-argument-parser, which handles this better than Commandant did. $ # Before
$ swiftlint --help
Unrecognized arguments: --help
$ # After
$ swiftlint --help
OVERVIEW: A tool to enforce Swift style and conventions.
USAGE: swiftlint <subcommand>
OPTIONS:
--version Show the version.
-h, --help Show help information.
SUBCOMMANDS:
analyze Run analysis rules
docs Open SwiftLint documentation website in the default web browser
generate-docs Generates markdown documentation for all rules
lint (default) Print lint warnings and errors
rules Display the list of rules and their identifiers
version Display the current version of SwiftLint
See 'swiftlint help <subcommand>' for detailed help. I'd appreciate if you could try out SwiftLint on the |
Thanks, I tried this out in 0.42. Vast improvement. I noticed a few wrinkles, but no regressions: OneI'm not sure what I expected
Two@axello 's suggestion here wasn't incorporated. ThreeThe output of any |
Thanks for trying it out and for your feedback! For your first point, For your second point, yes the help output includes
So However, if you run
Finally your third point, Thanks again for your feedback. |
Thank YOU (et. al) for your contributions to an awesome tool. |
I filed a PR with your suggestion to include the version number in the help output: apple/swift-argument-parser#258 |
If I type an unrecognized command, such as
$ swiftlint --help
, or$ swiftlint --version
, I'm toldWhen I ask
$ swiftlint help
, I'm told what the commands are, including the command for getting the current version. But I am not told the current version. I have to type that command.I propose that
the output triggered by an unrecognized command include the "help" text itself.
-help
and--help
both be recognized as valid2.1)
-v
and--version
both be valid, and produce the same output as the currently supported$ swiftlint version
the help output include the version string, e.g.
swiftlint version 0.13.2
Available commands:
autocorrect Automatically correct warnings and errors
help Display general or command-specific help
lint Print lint warnings and errors (default command)
rules Display the list of rules and their identifiers
version Display the current version of SwiftLint
The text was updated successfully, but these errors were encountered: