mirror of
https://github.com/Hopiu/micro.git
synced 2026-05-18 19:41:08 +00:00
parent
f3e8413e77
commit
6a465500bc
4 changed files with 25 additions and 1 deletions
|
|
@ -667,11 +667,15 @@ func (h *BufPane) SaveAs() bool {
|
||||||
if !canceled {
|
if !canceled {
|
||||||
// the filename might or might not be quoted, so unquote first then join the strings.
|
// the filename might or might not be quoted, so unquote first then join the strings.
|
||||||
args, err := shellquote.Split(resp)
|
args, err := shellquote.Split(resp)
|
||||||
filename := strings.Join(args, " ")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InfoBar.Error("Error parsing arguments: ", err)
|
InfoBar.Error("Error parsing arguments: ", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if len(args) == 0 {
|
||||||
|
InfoBar.Error("No filename given")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
filename := strings.Join(args, " ")
|
||||||
noPrompt := h.saveBufToFile(filename, "SaveAs")
|
noPrompt := h.saveBufToFile(filename, "SaveAs")
|
||||||
if noPrompt {
|
if noPrompt {
|
||||||
h.completeAction("SaveAs")
|
h.completeAction("SaveAs")
|
||||||
|
|
|
||||||
|
|
@ -349,6 +349,9 @@ func (h *BufPane) OpenCmd(args []string) {
|
||||||
InfoBar.Error("Error parsing args ", err)
|
InfoBar.Error("Error parsing args ", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if len(args) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
filename = strings.Join(args, " ")
|
filename = strings.Join(args, " ")
|
||||||
|
|
||||||
open := func() {
|
open := func() {
|
||||||
|
|
@ -966,6 +969,10 @@ func (h *BufPane) HandleCommand(input string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(args) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
inputCmd := args[0]
|
inputCmd := args[0]
|
||||||
|
|
||||||
if _, ok := commands[inputCmd]; !ok {
|
if _, ok := commands[inputCmd]; !ok {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ func RunTermEmulator(h *BufPane, input string, wait bool, getOutput bool, callba
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if len(args) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
t := new(shell.Terminal)
|
t := new(shell.Terminal)
|
||||||
t.Start(args, getOutput, wait, callback, userargs)
|
t.Start(args, getOutput, wait, callback, userargs)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package shell
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -36,6 +37,9 @@ func RunCommand(input string) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
if len(args) == 0 {
|
||||||
|
return "", errors.New("No arguments")
|
||||||
|
}
|
||||||
inputCmd := args[0]
|
inputCmd := args[0]
|
||||||
|
|
||||||
return ExecCommand(inputCmd, args[1:]...)
|
return ExecCommand(inputCmd, args[1:]...)
|
||||||
|
|
@ -49,6 +53,9 @@ func RunBackgroundShell(input string) (func() string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if len(args) == 0 {
|
||||||
|
return nil, errors.New("No arguments")
|
||||||
|
}
|
||||||
inputCmd := args[0]
|
inputCmd := args[0]
|
||||||
return func() string {
|
return func() string {
|
||||||
output, err := RunCommand(input)
|
output, err := RunCommand(input)
|
||||||
|
|
@ -72,6 +79,9 @@ func RunInteractiveShell(input string, wait bool, getOutput bool) (string, error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
if len(args) == 0 {
|
||||||
|
return "", errors.New("No arguments")
|
||||||
|
}
|
||||||
inputCmd := args[0]
|
inputCmd := args[0]
|
||||||
|
|
||||||
// Shut down the screen because we're going to interact directly with the shell
|
// Shut down the screen because we're going to interact directly with the shell
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue