mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-09 00:20:19 +09:00
Add eval command
This commit is contained in:
@@ -67,7 +67,6 @@ If you'd like to see more information after installing micro, run `micro -versio
|
||||
You can also install micro using Homebrew on Mac:
|
||||
|
||||
```
|
||||
$ brew tap zyedidia/micro
|
||||
$ brew install micro
|
||||
```
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ var commandActions = map[string]func([]string){
|
||||
"HSplit": HSplit,
|
||||
"Tab": NewTab,
|
||||
"Help": Help,
|
||||
"Eval": Eval,
|
||||
}
|
||||
|
||||
// InitCommands initializes the default commands
|
||||
@@ -82,6 +83,7 @@ func DefaultCommands() map[string]StrCommand {
|
||||
"hsplit": {"HSplit", []Completion{FileCompletion, NoCompletion}},
|
||||
"tab": {"Tab", []Completion{FileCompletion, NoCompletion}},
|
||||
"help": {"Help", []Completion{HelpCompletion, NoCompletion}},
|
||||
"eval": {"Eval", []Completion{NoCompletion}},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +146,18 @@ func HSplit(args []string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Eval evaluates a lua expression
|
||||
func Eval(args []string) {
|
||||
if len(args) >= 1 {
|
||||
err := L.DoString(args[0])
|
||||
if err != nil {
|
||||
messenger.Error(err)
|
||||
}
|
||||
} else {
|
||||
messenger.Error("Not enough arguments")
|
||||
}
|
||||
}
|
||||
|
||||
// NewTab opens the given file in a new tab
|
||||
func NewTab(args []string) {
|
||||
if len(args) == 0 {
|
||||
|
||||
@@ -401,7 +401,7 @@ func runtimeHelpColorsMd() (*asset, error) {
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _runtimeHelpCommandsMd = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x8c\x54\xcd\x8e\xe3\x36\x13\xbc\xeb\x29\x0a\xf3\x1d\xe6\x4b\x30\xf6\x03\xf8\x12\x04\xb9\x24\x40\x10\x24\xd9\xbd\xe4\x26\x4a\x6a\x59\x84\x29\xb6\x96\xdd\xb4\xd7\x79\xfa\xa0\x49\x5a\x33\xb3\x93\x43\x6e\x12\xbb\x58\x55\xec\xbf\xff\xe1\x77\x16\xf1\x43\x20\x8c\xbc\xae\x2e\x4e\xd2\x75\x7f\x71\xc6\xe8\x22\xe8\x2b\x8d\x59\x09\xf6\x39\x79\xe5\xf4\xc0\x60\xb8\x63\x4b\x24\xe2\xe3\x19\xfd\x4f\x9a\xc2\x81\x7a\xcc\x1c\x02\xdf\xa8\x44\x75\xd9\x09\x8f\xdd\xcf\x94\x08\x2e\x51\x39\xdd\xbe\xd5\x83\x2e\x4e\x71\x6f\x9a\x59\xe8\xd8\x75\xdf\xa3\xff\x92\xbd\xf6\x27\xfc\x91\xbd\x0a\x56\x3f\x26\xae\xe7\xe2\xae\x84\xd9\x07\x8a\x6e\xa5\x1f\xfa\x13\x3e\xb9\x2b\x49\x15\xcc\x29\x51\x54\x0c\x79\x9e\x29\x1d\xf1\xcb\x5c\x8e\x1f\x60\x78\xc1\x96\xf8\xea\x27\x9a\xe0\x15\x37\x1f\x42\x07\xe0\xb9\x50\x3a\x79\x7e\x87\xae\x6a\x89\xb6\xe0\x46\xc2\x93\x90\x4b\xe3\xf2\x84\xa7\xab\x0b\x99\x9e\x30\x07\x77\x96\xfe\x84\xcf\x8b\x97\xc2\x84\x07\xb4\xaf\xd0\x1e\x37\xaf\x0b\xfa\x82\xef\x8f\x30\xa5\xcf\x0b\xa1\xaf\x37\x4b\x3e\x78\x53\xcf\xd1\x85\xa3\x05\x7f\x54\xa8\x91\x6d\xec\xa3\xbe\x98\x97\x54\x2c\x73\x0c\x77\x70\xa4\x22\x79\x42\x3f\xf6\x2f\xb8\x2d\x7e\x5c\x40\xd1\x0d\x81\x04\xfd\xb8\xd0\x78\xe9\xb1\xf2\x44\x45\xa7\x86\x9d\x5c\x04\x7e\xb6\xd4\x3e\x4f\x08\xfe\x42\x50\xc6\x46\x69\xe6\xb4\x96\xb7\x36\xcb\xab\x25\x8d\xdc\xb8\x40\xfd\x4a\x9d\x31\xfc\xc6\x4a\xb5\x30\xfb\x73\xd6\x2c\x8a\x81\xe0\x70\x75\xc1\x4f\x48\x74\xa6\xaf\x47\x58\x96\xcd\x1d\xd7\x64\xbb\x74\xce\xc6\x27\xc6\x32\x31\x09\x22\x2b\x96\x92\xe1\x78\x87\x6c\x6e\x24\x81\x8f\xf0\xfa\x52\x8a\xbe\xba\x3b\x78\xf5\x5a\x6e\x7f\xc9\xac\x24\xad\xd0\xa4\x2d\x41\xa8\x39\x3c\x41\x48\x6b\xa5\xdb\xb9\x72\x0d\x1d\xf1\x89\x6a\x77\xf5\x35\x22\x3d\x16\x0a\x1b\x94\x37\x3f\x9a\x93\x99\x13\x1c\x82\x17\x35\xa3\x0d\xb4\x37\x9d\x90\xee\x9a\x81\x47\x17\xfe\xab\x30\x0a\x3a\xdc\xf1\xff\x52\x25\x1f\xdf\xf6\xa1\xe9\xd6\x56\xfc\xae\xb1\x2f\x7c\x6b\x0c\xc6\xb9\xf0\xed\x7d\xdf\x56\xca\x96\xc8\xb3\xbf\x52\x6c\xe8\xd6\x8b\x39\x42\x96\x43\x9b\x9b\xfe\x84\x94\xa3\xbc\xc1\xca\x42\x21\xec\x23\xda\xbc\x0c\x6e\xbc\x9c\x13\xe7\x38\x1d\x4b\xfb\x99\xa9\x06\x79\x16\x70\xd6\x2d\xd7\x49\xb0\xd2\x4e\x5e\xb6\xe0\xee\x54\x6e\x5b\x51\x83\x8f\x84\xdb\x42\x56\x2e\xcc\x3e\x7a\x59\x48\x4c\x37\xfa\x78\xae\xae\x06\x1f\x27\x5c\xe8\x0e\x37\xb6\x87\x8d\x89\x9c\x92\xc0\xd9\xb1\x85\x6d\x4b\xcc\x89\xd7\x02\x53\x6e\xc8\xd7\xa2\x09\x8d\xb5\x1e\x1c\xcd\xde\xeb\x2d\x81\x1b\xd8\xc6\x9d\x13\x56\xb6\x71\x88\x33\xdb\x99\x79\xb6\xe6\xbc\xd0\x5d\x60\xaf\x75\x8d\xc1\xa6\xca\x5d\x9d\x0f\x36\x19\xd5\xe0\x55\xb6\x50\xdc\xd7\xb9\xee\x4f\xe0\x8d\x0c\x8a\x2b\x25\xf5\x56\xed\x8a\xa8\xf3\xba\xe3\xca\xfe\x88\xfc\x76\x7d\x98\xbb\xc7\x06\x79\xf9\x48\x60\xc3\xba\x51\xa4\xa9\x52\xd9\xda\x5c\x37\xbd\xb7\x26\x28\x66\x96\x0f\x66\xc4\xa8\x9d\x3c\x7c\xf6\x18\xb2\xee\x0e\x17\x4e\xfe\x6f\x8e\xfa\x2a\x11\x45\xc9\x4d\xe0\xd9\xbc\x7c\xeb\xa0\x48\xa8\x1b\x3e\x3e\xf6\xb5\x4b\x2c\x64\xe5\x75\x88\x74\x83\xba\xe1\xd8\x75\x87\xc3\xa1\xeb\xac\x3b\xea\x0a\xb7\x7a\xed\xdb\xd9\x32\xba\x6f\xcd\xb6\xd9\x27\x9a\x5d\x0e\x8a\x2d\xe4\xb3\x8f\x72\x2a\xba\xc1\x47\x5b\xd8\xbf\xfa\xa8\xef\xba\xba\x08\x5a\x05\x29\x25\x4e\x6d\xb8\xcf\x3c\xaf\x86\xfe\x33\x47\x94\x6f\x70\xfc\x70\xeb\x01\xf5\xeb\xc6\x49\x65\x87\xb7\xff\x7f\xbf\xf2\x4f\x00\x00\x00\xff\xff\xe7\x1a\x2f\x48\xd2\x06\x00\x00")
|
||||
var _runtimeHelpCommandsMd = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x8c\x55\xc1\x8e\x1b\x37\x0c\xbd\xfb\x2b\x1e\xdc\xc3\x26\xc5\xee\x7c\x80\x2f\x45\x51\x14\x68\x81\xb4\x68\x9b\x5c\x7a\x93\x3c\xc3\x19\x09\xd6\x88\x13\x51\xb2\x33\xfd\xfa\x82\x92\xd6\xbb\xc9\xf6\xd0\x9b\x2d\x3d\x3e\x3e\x91\x8f\x9c\xef\xf0\x07\x8b\xf8\x73\x20\x8c\xbc\xae\x36\x4e\x72\x38\xfc\xcd\x05\xa3\x8d\xa0\x2f\x34\x96\x4c\xd0\x9f\x93\xcf\x9c\x9e\x31\x38\xef\xd8\x12\x89\xf8\xb8\xc0\xfc\x94\x53\x78\x22\x83\x99\x43\xe0\x1b\xd5\xdb\xec\xee\x84\xc3\xe1\x17\x4a\x04\x9b\xa8\x9e\x6e\xdf\xe6\x43\x76\x36\x63\xef\x39\x8b\xd0\x70\x38\x7c\x0f\xf3\xb9\xf8\x6c\x4e\xf8\xb3\xf8\x2c\x58\xfd\x98\xb8\x9d\x8b\xbd\x12\x66\x1f\x28\xda\x95\x7e\x30\x27\x7c\xb4\x57\x92\x96\xb0\xa4\x44\x31\xe3\x5c\xe6\x99\xd2\x80\x5f\xe7\x7a\xfc\x0c\x86\x17\x6c\x89\xaf\x7e\xa2\x09\x3e\xe3\xe6\x43\x38\x00\x78\xa8\x94\x56\x1e\xbe\x42\xb7\x6c\x89\xb6\x60\x47\xc2\x51\xc8\xa6\xd1\x1d\x71\xbc\xda\x50\xe8\x88\x39\xd8\x45\xcc\x09\x9f\x9c\x97\xca\x84\x67\xa8\x69\x50\x83\x9b\xcf\x0e\xa6\xe2\xcd\x00\xcd\xf4\xc9\x11\x4c\x8b\xac\xf5\xe0\x2d\x7b\x8e\x36\x0c\x7a\xf9\x63\x46\x56\xb2\x8d\x7d\xcc\x8f\xaa\x25\x55\xc9\x1c\xc3\x0e\x8e\x54\x53\x9e\x60\x46\xf3\x88\x9b\xf3\xa3\x03\x45\x7b\x0e\x24\x30\xa3\xa3\xf1\x62\xb0\xf2\x44\x35\x4f\xbb\xb6\x72\x11\xf8\x59\x4b\xfb\x30\x21\xf8\x0b\x21\x33\x36\x4a\x33\xa7\xb5\xbe\xb5\x4b\x5e\xb5\x68\x64\x47\x87\xec\x57\x3a\x28\xc3\xef\x9c\xa9\x35\xe6\xfe\x9c\xb5\x48\xc6\x99\x60\x71\xb5\xc1\x4f\x48\xb4\xd0\x97\x01\x5a\x65\x55\xc7\xad\xd8\x36\x2d\x45\xf9\x44\x59\x26\x26\x41\xe4\x0c\x57\x2b\x1c\x77\xc8\x66\x47\x12\xf8\x08\x9f\x1f\x6b\xd3\x57\xbb\x83\x57\x9f\x6b\xf4\xe7\xc2\x99\xa4\x37\x9a\x72\x2f\x10\x5a\x0d\x4f\x10\xca\xad\xd3\xfd\x3c\x73\xbb\x1a\xf0\x91\x9a\xbb\x4c\xbb\x11\x03\x47\x61\x43\xe6\xcd\x8f\xaa\x64\xe6\x04\x8b\xe0\x25\xab\xd0\x0e\xba\x9b\x4e\x28\xdf\x73\x06\x1e\x6d\xf8\xbf\x89\x51\xd1\x61\xc7\xbb\xda\x25\x1f\x5f\xfb\x50\xf3\x36\x2b\xbe\xef\xec\x8e\x6f\x9d\x41\x39\x1d\xdf\xbe\xf6\x6d\xa3\xec\x85\x5c\xfc\x95\x62\x47\xb7\x70\xba\xda\x80\x23\x7d\x69\x93\xc7\xf1\x68\x4e\xf8\x59\x63\x6c\x26\x81\xc5\x87\x62\xf1\x72\x3b\xbc\xea\x61\x1d\x9f\xe6\xd2\xc8\x55\xd7\x96\x7c\xcc\xda\x91\xec\x74\x86\x85\x6b\x2d\xc4\x71\x09\x93\xce\x20\xcc\x4a\x22\x14\x17\x4a\xa7\xdf\x48\xc4\x2e\xf4\x6e\x18\x86\xf7\x46\x9f\x3e\x79\xd9\x82\xdd\x61\x95\xa9\x35\xa0\x0d\x4b\x89\x10\xf7\xd4\x07\xdb\x9c\x90\x4a\x94\x57\x8f\x11\x47\x21\xdc\x77\x48\x2f\xd6\xd9\x8e\x97\x25\x71\x89\xd3\x50\xe7\x43\x39\x3b\xe4\x41\xc0\x25\x6f\xa5\x8d\xaa\x7a\xaf\x67\xa6\x1a\xad\xae\x0b\x3e\x12\x6e\x8e\xd4\x4f\x98\x7d\xf4\xe2\x48\x34\x6f\xf4\x71\x69\xaa\xce\x3e\x4e\xb8\xd0\x0e\x3b\xf6\xca\x8f\x89\x7a\xc9\x2e\xb4\xeb\xb5\x96\x60\x4e\xbc\x56\x58\xe6\x8e\x7c\x71\x95\xd0\xd8\x0c\xc3\x51\xe5\xbd\x44\x09\xec\x99\x75\x1f\x71\xc2\xca\x3a\xaf\x71\x66\x3d\x53\xcd\x5a\xf9\x0b\xed\x02\x7d\xad\xed\x0c\x3a\xf6\xf6\x6a\x7d\xd0\xd1\x6d\x02\xaf\xb2\x85\xaa\xbe\x2d\x1e\x73\x02\x6f\xa4\x50\x5c\x29\x65\xaf\x76\x6c\x88\xb6\x50\xee\xb8\xba\xe0\x22\xbf\xde\x6f\xad\xb5\x6d\xc5\x3d\xbe\x25\xd0\x6d\xb2\x51\xa4\xa9\x51\xe9\x5e\x5f\xb7\xbc\x77\x97\x56\x31\xee\x8d\x18\x51\x6a\x2b\xcf\x3a\x0d\xce\x25\xdf\x15\x3a\x4e\xfe\x1f\x8e\xf9\x25\x45\x94\x4c\x76\x02\xcf\xaa\xe5\x5b\x05\x35\x45\xb6\xe7\xb7\x8f\x7d\x71\x89\x5e\x69\x7b\x2d\x22\xdd\x90\xed\x79\x38\x1c\x9e\x9e\x9e\x0e\x07\x75\x47\xfb\xc6\x68\xbf\xee\x9f\x0f\xad\xe8\x7d\xad\xf7\x4f\xcf\x44\xb3\x2d\x21\x63\x0b\x65\xf1\x51\x4e\x35\x6f\xf0\x51\xbf\x28\x1f\xd4\xf9\xaf\xc7\xae\x26\xd4\x0e\x52\x4a\x9c\xfa\xf6\x59\x78\x5e\x15\xfd\x57\x89\xa8\xbf\xc1\xf1\x4d\xd4\x33\xd4\xaf\x1b\xa7\x2c\x77\x78\xff\xff\xdf\x21\xff\x06\x00\x00\xff\xff\x95\xdb\x99\xe7\x73\x07\x00\x00")
|
||||
|
||||
func runtimeHelpCommandsMdBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
|
||||
@@ -24,6 +24,10 @@ Here are the possible commands that you can use.
|
||||
|
||||
* `show option`: shows the current value of the given option.
|
||||
|
||||
* `eval "expression"`: Evaluates a Lua expression. Note that micro will not
|
||||
print anything so you should use `messenger:Message(...)` to display a
|
||||
value.
|
||||
|
||||
* `run sh-command`: runs the given shell command in the background. The
|
||||
command's output will be displayed in one line when it finishes running.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user