From a89ddea619eedf4dec3028bac8386ae3f051acc2 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Wed, 2 Jan 2019 16:04:41 -0500 Subject: [PATCH] Fix error --- cmd/micro/action/command.go | 59 +++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/cmd/micro/action/command.go b/cmd/micro/action/command.go index a36ec66a..a4c28c2c 100644 --- a/cmd/micro/action/command.go +++ b/cmd/micro/action/command.go @@ -3,6 +3,7 @@ package action import ( "os" + "github.com/zyedidia/micro/cmd/micro/info" "github.com/zyedidia/micro/cmd/micro/shellwords" "github.com/zyedidia/micro/cmd/micro/util" ) @@ -10,13 +11,13 @@ import ( // A Command contains an action (a function to call) as well as information about how to autocomplete the command type Command struct { action func([]string) - completions []Completion + completions []info.Completion } // A StrCommand is similar to a command but keeps the name of the action type StrCommand struct { action string - completions []Completion + completions []info.Completion } var commands map[string]Command @@ -70,7 +71,7 @@ func parseCommands(userCommands map[string]StrCommand) { // MakeCommand is a function to easily create new commands // This can be called by plugins in Lua so that plugins can define their own commands -func MakeCommand(name, function string, completions ...Completion) { +func MakeCommand(name, function string, completions ...info.Completion) { action := commandActions[function] // if _, ok := commandActions[function]; !ok { // If the user seems to be binding a function that doesn't exist @@ -84,32 +85,32 @@ func MakeCommand(name, function string, completions ...Completion) { // DefaultCommands returns a map containing micro's default commands func DefaultCommands() map[string]StrCommand { return map[string]StrCommand{ - "set": {"Set", []Completion{OptionCompletion, OptionValueCompletion}}, - "setlocal": {"SetLocal", []Completion{OptionCompletion, OptionValueCompletion}}, - "show": {"Show", []Completion{OptionCompletion, NoCompletion}}, - "showkey": {"ShowKey", []Completion{NoCompletion}}, - "bind": {"Bind", []Completion{NoCompletion}}, - "run": {"Run", []Completion{NoCompletion}}, - "quit": {"Quit", []Completion{NoCompletion}}, - "save": {"Save", []Completion{NoCompletion}}, - "replace": {"Replace", []Completion{NoCompletion}}, - "replaceall": {"ReplaceAll", []Completion{NoCompletion}}, - "vsplit": {"VSplit", []Completion{FileCompletion, NoCompletion}}, - "hsplit": {"HSplit", []Completion{FileCompletion, NoCompletion}}, - "tab": {"Tab", []Completion{FileCompletion, NoCompletion}}, - "help": {"Help", []Completion{HelpCompletion, NoCompletion}}, - "eval": {"Eval", []Completion{NoCompletion}}, - "log": {"ToggleLog", []Completion{NoCompletion}}, - "plugin": {"Plugin", []Completion{PluginCmdCompletion, PluginNameCompletion}}, - "reload": {"Reload", []Completion{NoCompletion}}, - "cd": {"Cd", []Completion{FileCompletion}}, - "pwd": {"Pwd", []Completion{NoCompletion}}, - "open": {"Open", []Completion{FileCompletion}}, - "tabswitch": {"TabSwitch", []Completion{NoCompletion}}, - "term": {"Term", []Completion{NoCompletion}}, - "memusage": {"MemUsage", []Completion{NoCompletion}}, - "retab": {"Retab", []Completion{NoCompletion}}, - "raw": {"Raw", []Completion{NoCompletion}}, + "set": {"Set", []info.Completion{info.OptionCompletion, info.OptionValueCompletion}}, + "setlocal": {"SetLocal", []info.Completion{info.OptionCompletion, info.OptionValueCompletion}}, + "show": {"Show", []info.Completion{info.OptionCompletion, info.NoCompletion}}, + "showkey": {"ShowKey", []info.Completion{info.NoCompletion}}, + "bind": {"Bind", []info.Completion{info.NoCompletion}}, + "run": {"Run", []info.Completion{info.NoCompletion}}, + "quit": {"Quit", []info.Completion{info.NoCompletion}}, + "save": {"Save", []info.Completion{info.NoCompletion}}, + "replace": {"Replace", []info.Completion{info.NoCompletion}}, + "replaceall": {"ReplaceAll", []info.Completion{info.NoCompletion}}, + "vsplit": {"VSplit", []info.Completion{info.FileCompletion, info.NoCompletion}}, + "hsplit": {"HSplit", []info.Completion{info.FileCompletion, info.NoCompletion}}, + "tab": {"Tab", []info.Completion{info.FileCompletion, info.NoCompletion}}, + "help": {"Help", []info.Completion{info.HelpCompletion, info.NoCompletion}}, + "eval": {"Eval", []info.Completion{info.NoCompletion}}, + "log": {"ToggleLog", []info.Completion{info.NoCompletion}}, + "plugin": {"Plugin", []info.Completion{info.PluginCmdCompletion, info.PluginNameCompletion}}, + "reload": {"Reload", []info.Completion{info.NoCompletion}}, + "cd": {"Cd", []info.Completion{info.FileCompletion}}, + "pwd": {"Pwd", []info.Completion{info.NoCompletion}}, + "open": {"Open", []info.Completion{info.FileCompletion}}, + "tabswitch": {"TabSwitch", []info.Completion{info.NoCompletion}}, + "term": {"Term", []info.Completion{info.NoCompletion}}, + "memusage": {"MemUsage", []info.Completion{info.NoCompletion}}, + "retab": {"Retab", []info.Completion{info.NoCompletion}}, + "raw": {"Raw", []info.Completion{info.NoCompletion}}, } }