-
Notifications
You must be signed in to change notification settings - Fork 22
/
util.go
34 lines (29 loc) · 797 Bytes
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"fmt"
prompt "github.com/c-bata/go-prompt"
)
func fillSpace(str string, needLen int) string {
res := str
strLen := len(str)
for strLen < needLen {
res = string(append([]byte(res), ' '))
strLen++
}
return res
}
func completer(d prompt.Document) []prompt.Suggest {
s := []prompt.Suggest{
{Text: "MOV", Description: "MOV dest, src"},
{Text: "PUSH", Description: "PUSH src"},
{Text: "POP", Description: "POP dest"},
{Text: "ADD", Description: "ADD dest,src"},
{Text: "SUB", Description: "SUB dest,src"},
{Text: "INC", Description: "INC dest"},
{Text: "DEC", Description: "DEC dest"},
}
return prompt.FilterHasPrefix(s, d.GetWordBeforeCursor(), true)
}
func helperInfo() {
fmt.Println("detailed info can be referred at http://ref.x86asm.net/")
}