WIP start writing this for real

trunk
vilmibm 2023-02-03 05:03:03 +00:00
parent cf99807126
commit 6b86087c0e
1 changed files with 55 additions and 23 deletions

View File

@ -30,15 +30,13 @@ in sshd_config, and:
auth [success=done default=ignore] pam_succeed_if.so user ingroup join
in /etc/pam.d/sshd
*/
/*
type TownApplication struct {
Email string
is there a way :qa
*/
// TODO
}
type streams struct {
In io.Reader
@ -46,6 +44,55 @@ type streams struct {
Err io.Writer
}
func cli(s *streams) error {
pages := tview.NewPages()
mainFlex := tview.NewFlex()
innerFlex := tview.NewFlex()
input := tview.NewTextArea()
title := tview.NewTextView()
title.SetDynamicColors(true)
title.SetTextAlign(tview.AlignCenter)
title.SetText("[purple]the tilde town sign up portal[-]")
msgScroll := tview.NewTextView()
msgScroll.SetDynamicColors(true)
sidebar := tview.NewTextView()
sidebar.SetBorder(true)
sidebar.SetDynamicColors(true)
sidebar.SetText("[-:-:b]pbbt[-:-:-]")
innerFlex.SetDirection(tview.FlexColumn)
innerFlex.AddItem(msgScroll, 0, 2, false)
innerFlex.AddItem(sidebar, 0, 1, false)
mainFlex.SetDirection(tview.FlexRow)
mainFlex.AddItem(title, 1, -1, false)
mainFlex.AddItem(innerFlex, 0, 1, false)
mainFlex.AddItem(input, 5, -1, true)
pages.AddPage("main", mainFlex, true, true)
app := tview.NewApplication()
app.SetRoot(pages, true)
return app.Run()
}
func main() {
s := &streams{
In: os.Stdin,
Out: os.Stdout,
Err: os.Stderr,
}
err := cli(s)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
type Prompter struct {
in io.Reader
out io.Writer
@ -203,8 +250,8 @@ func _main(args []string, s *streams) error {
exec.Command("stty", "-F", "/dev/tty", "cbreak", "min", "1").Run()
// LOL i don't think this will work
reader := bufio.NewReader(p.in)
s, _ := reader.ReadString(4)
//reader := bufio.NewReader(p.in)
//s, _ := reader.ReadString(4)
fmt.Printf("DBG %#v\n", s)
//var b []byte = make([]byte, 100)
//for {
@ -349,18 +396,3 @@ func edit(s *streams, a *answers) error {
return app.SetRoot(form, true).EnableMouse(true).Run()
}
func main() {
retcode := 0
s := &streams{
In: os.Stdin,
Out: os.Stdout,
Err: os.Stderr,
}
err := _main(os.Args, s)
if err != nil {
retcode = 1
fmt.Fprintln(os.Stderr, err)
}
os.Exit(retcode)
}