* showing help by basic call
All checks were successful
Build and Test / build-test (1.23.4) (push) Successful in 1m37s
All checks were successful
Build and Test / build-test (1.23.4) (push) Successful in 1m37s
* autocompletion for exec
This commit is contained in:
11
util/util.go
11
util/util.go
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"github.com/spf13/cobra"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func SaveConfig(data *map[string]string) error {
|
||||
@@ -19,3 +20,13 @@ func SaveConfig(data *map[string]string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func AutocompleteConfig(conf *map[string]string, partialInput string) []string {
|
||||
var result []string
|
||||
for key := range *conf {
|
||||
if strings.Contains(key, partialInput) {
|
||||
result = append(result, key)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user