Add Bash Completion Script
This commit is contained in:
parent
6b3b39ad40
commit
6a152aa6b4
@ -3,3 +3,9 @@ CLI Emojis
|
||||
|
||||
Binaries:
|
||||
https://bullercodeworks.com/downloads/emt/
|
||||
|
||||
Included is a completion script for bash:
|
||||
* `emt-completion.bash`
|
||||
|
||||
Just put `emt` in your path, then source the completion script when you
|
||||
fire up your shell (put a line in your bashrc or something)
|
||||
|
3
emt-completion.bash
Normal file
3
emt-completion.bash
Normal file
@ -0,0 +1,3 @@
|
||||
#/usr/bin/env bash
|
||||
WORDLIST=`emt -completion-list`
|
||||
complete -W "$WORDLIST" emt
|
6
main.go
6
main.go
@ -16,15 +16,19 @@ func main() {
|
||||
var getApprox bool
|
||||
var which string
|
||||
var matchWhich string
|
||||
allEmoji := emoji.CodeMap()
|
||||
for _, v := range os.Args {
|
||||
if v == "-a" {
|
||||
getApprox = true
|
||||
} else if v == "-completion-list" {
|
||||
for k, _ := range allEmoji {
|
||||
fmt.Print(strings.Trim(k, ":"), " ")
|
||||
}
|
||||
} else {
|
||||
which = v
|
||||
}
|
||||
}
|
||||
|
||||
allEmoji := emoji.CodeMap()
|
||||
if !strings.HasPrefix(which, ":") && !strings.HasSuffix(which, ":") {
|
||||
matchWhich = ":" + which + ":"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user