123456789101112131415161718192021222324252627282930313233 |
- package main
- import (
- "fmt"
- "git.swzry.com/zry/go-hhc-cli/hhccli"
- "git.swzry.com/zry/go-hhc-cli/oldfiles"
- "golang.org/x/crypto/ssh/terminal"
- "os"
- )
- func main() {
- fdbg, err := os.OpenFile("debug.log", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
- defer func() { _ = fdbg.Close() }()
- if err != nil {
- fmt.Println("Failed Open Debug Log File:", err.Error())
- return
- }
- _, err = terminal.MakeRaw(int(os.Stdin.Fd()))
- if err != nil {
- fmt.Print("Failed Make Terminal Raw:", err.Error(), "\r\n")
- return
- }
- sysview := hhccli.NewCliView(maketree())
- cih := oldfiles.NewInteractiveCli(os.Stdin, os.Stdout, os.Stderr, "[GO-HHC-CLI]")
- cih.SetDebugOut(fdbg)
- cih.RegisterView("system", sysview)
- _ = cih.SetCurrentView("system")
- err = cih.Run()
- if err != nil {
- fmt.Print("Failed Processing CLI:", err.Error(), "\r\n")
- return
- }
- }
|