mirror of https://github.com/Hilbis/Hilbish
Compare commits
No commits in common. "08c56a54ca10fba5bac178e1c0d2051253888df9" and "94f0ccf9f6c2118ededab7605bf976af83b045ec" have entirely different histories.
08c56a54ca
...
94f0ccf9f6
35
main.go
35
main.go
|
@ -2,36 +2,35 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
hooks "hilbish/golibs/bait"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"os/user"
|
"os/user"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
hooks "hilbish/golibs/bait"
|
|
||||||
|
|
||||||
"github.com/akamensky/argparse"
|
"github.com/akamensky/argparse"
|
||||||
"github.com/bobappleyard/readline"
|
"github.com/bobappleyard/readline"
|
||||||
"github.com/yuin/gopher-lua"
|
lua "github.com/yuin/gopher-lua"
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "0.3.2"
|
const version = "0.3.2"
|
||||||
|
|
||||||
var (
|
var l *lua.LState
|
||||||
l *lua.LState
|
|
||||||
|
|
||||||
// User's prompt, this will get set when lua side is initialized
|
// User's prompt, this will get set when lua side is initialized
|
||||||
prompt string
|
var prompt string
|
||||||
multilinePrompt = "> "
|
var multilinePrompt = "> "
|
||||||
|
|
||||||
commands = map[string]bool{}
|
// Map of builtin/custom commands defined in the commander lua module
|
||||||
aliases = map[string]string{}
|
var commands = map[string]bool{}
|
||||||
|
|
||||||
bait hooks.Bait
|
// Command aliases
|
||||||
homedir string
|
var aliases = map[string]string{}
|
||||||
running bool
|
var bait hooks.Bait
|
||||||
)
|
var homedir string
|
||||||
|
var running bool
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
homedir, _ = os.UserHomeDir()
|
homedir, _ = os.UserHomeDir()
|
||||||
|
@ -40,15 +39,15 @@ func main() {
|
||||||
parser := argparse.NewParser("hilbish", "A shell for lua and flower lovers")
|
parser := argparse.NewParser("hilbish", "A shell for lua and flower lovers")
|
||||||
verflag := parser.Flag("v", "version", &argparse.Options{
|
verflag := parser.Flag("v", "version", &argparse.Options{
|
||||||
Required: false,
|
Required: false,
|
||||||
Help: "Prints Hilbish version",
|
Help: "Prints Hilbish version",
|
||||||
})
|
})
|
||||||
setshflag := parser.Flag("S", "set-shell-env", &argparse.Options{
|
setshflag := parser.Flag("S", "set-shell-env", &argparse.Options{
|
||||||
Required: false,
|
Required: false,
|
||||||
Help: "Sets $SHELL to Hilbish's executed path",
|
Help: "Sets $SHELL to Hilbish's executed path",
|
||||||
})
|
})
|
||||||
configflag := parser.String("C", "config", &argparse.Options{
|
configflag := parser.String("C", "config", &argparse.Options{
|
||||||
Required: false,
|
Required: false,
|
||||||
Help: "Sets the path to Hilbish's config",
|
Help: "Sets the path to Hilbish's config",
|
||||||
Default: defaultconfpath,
|
Default: defaultconfpath,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -164,7 +163,7 @@ func fmtPrompt() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, v := range args {
|
for i, v := range args {
|
||||||
if i % 2 == 0 {
|
if i%2 == 0 {
|
||||||
args[i] = "%" + v
|
args[i] = "%" + v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue