mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
Small optimization + consistent variable names style
This commit is contained in:
parent
0024beaedc
commit
adadaba75e
1 changed files with 6 additions and 5 deletions
|
@ -359,18 +359,19 @@ type TabComplete struct{}
|
||||||
|
|
||||||
func (t TabComplete) Do(line []rune, pos int) ([][]rune, int) {
|
func (t TabComplete) Do(line []rune, pos int) ([][]rune, int) {
|
||||||
var words = strings.SplitAfter(string(line), "-")
|
var words = strings.SplitAfter(string(line), "-")
|
||||||
var last_partial_word = words[len(words)-1]
|
var lastPartialWord = words[len(words)-1]
|
||||||
if len(last_partial_word) == 0 {
|
var nbCharacter = len(lastPartialWord)
|
||||||
|
if nbCharacter == 0 {
|
||||||
// No completion
|
// No completion
|
||||||
return [][]rune{[]rune("")}, 0
|
return [][]rune{[]rune("")}, 0
|
||||||
}
|
}
|
||||||
var strArray [][]rune
|
var strArray [][]rune
|
||||||
for _, s := range mnemonicode.WordList {
|
for _, s := range mnemonicode.WordList {
|
||||||
if strings.HasPrefix(s, last_partial_word) {
|
if strings.HasPrefix(s, lastPartialWord) {
|
||||||
strArray = append(strArray, []rune(s[len(last_partial_word):]))
|
strArray = append(strArray, []rune(s[nbCharacter:]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return strArray, len(last_partial_word)
|
return strArray, nbCharacter
|
||||||
}
|
}
|
||||||
|
|
||||||
func receive(c *cli.Context) (err error) {
|
func receive(c *cli.Context) (err error) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue