mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
Rearrange main.go a bit.
This commit is contained in:
parent
8215baf392
commit
36d17550cb
22
main.go
22
main.go
|
@ -20,26 +20,20 @@ import (
|
|||
"github.com/elves/elvish/util"
|
||||
)
|
||||
|
||||
const (
|
||||
sigchSize = 32
|
||||
outChanSize = 32
|
||||
outChanLeader = "▶ "
|
||||
)
|
||||
|
||||
var Logger = util.GetLogger("[main] ")
|
||||
|
||||
func usage() {
|
||||
fmt.Println("usage: elvish [flags] [script]")
|
||||
fmt.Println("flags:")
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
||||
var (
|
||||
log = flag.String("log", "", "a file to write debug log to")
|
||||
dbname = flag.String("db", "", "path to the database")
|
||||
help = flag.Bool("help", false, "show usage help and quit")
|
||||
)
|
||||
|
||||
func usage() {
|
||||
fmt.Println("usage: elvish [flags] [script]")
|
||||
fmt.Println("flags:")
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
||||
func main() {
|
||||
defer rescue()
|
||||
|
||||
|
@ -84,12 +78,11 @@ func rescue() {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(xiaq): Currently only the editor deals with signals.
|
||||
func interact() {
|
||||
ev, st := newEvalerAndStore()
|
||||
defer closeStore(st)
|
||||
|
||||
sigch := make(chan os.Signal, sigchSize)
|
||||
sigch := make(chan os.Signal)
|
||||
signal.Notify(sigch)
|
||||
|
||||
ed := edit.NewEditor(os.Stdin, sigch, ev, st)
|
||||
|
@ -139,7 +132,6 @@ func interact() {
|
|||
// name := fmt.Sprintf("<tty %d>", cmdNum)
|
||||
|
||||
lr := readLine()
|
||||
// signal.Stop(sigch)
|
||||
|
||||
if lr.EOF {
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue
Block a user