-
Notifications
You must be signed in to change notification settings - Fork 33
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
Autocompletion #22
base: master
Are you sure you want to change the base?
Autocompletion #22
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22 +/- ##
============================================
+ Coverage 81.79% 82.82% +1.02%
- Complexity 137 143 +6
============================================
Files 11 12 +1
Lines 357 390 +33
Branches 72 73 +1
============================================
+ Hits 292 323 +31
- Misses 30 32 +2
Partials 35 35
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it took so long for me to review this. I was swamped with other stuff.
Overall, this looks great! Thank you for this contribution. I only have a few minor suggestions.
class ShowAutoCompletionException internal constructor( | ||
private val autoCompletion: AutoCompletion, | ||
private val delegates: List<ArgParser.Delegate<*>> | ||
) : SystemExitException("Help was requested", 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Help/Autocompletion/
@@ -0,0 +1,49 @@ | |||
// Copyright © 2016 Laurence Gonsalves |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be 2017 and your name.
class DefaultAutoCompletion : AutoCompletion { | ||
override fun format(progName: String?, delegates: List<ArgParser.Delegate<*>>): String { | ||
val sb = StringBuilder() | ||
sb.append("_$progName()\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps triple-quoted strings would make this a bit easier to read?
Fix #9
Implement basic functionallity for generating bash/zsh autocompletion script.
Note: The implementation of Delegate:toAutoCompletion is maybe not the best way to do this. But I needed a way to access the optionNames.