Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
initial commit.
  • Loading branch information
akrennmair committed Mar 18, 2011
0 parents commit 0771ccc
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Makefile
@@ -0,0 +1,6 @@
include $(GOROOT)/src/Make.inc

TARG=zzz
GOFILES=zzz.go view.go

include $(GOROOT)/src/Make.cmd
22 changes: 22 additions & 0 deletions screen.stfl
@@ -0,0 +1,22 @@
vbox
@label#style_normal:fg=yellow,bg=blue,attr=bold
label
text:"zzz 0.0"
.expand:0
.height:1
list
.expand:vh
pos[listpos]:0
listitem text:"foo"
label
text[info]:"some general information about whatever"
.expand:0
hbox
.expand:0
label
text[prompt]:"Prompt: "
style_normal:
.expand:0
input
.expand:h
text[mytext]:""
32 changes: 32 additions & 0 deletions view.go
@@ -0,0 +1,32 @@
package main

import (
"stfl"
)

type View struct {
f *stfl.Form
}

func CreateView() (v *View) {
v = new(View)
v.f = stfl.Create("<screen.stfl>")
return
}

func(v View) Run() {

quit := false

for !quit {
key := v.f.Run(0)
switch key {
case "q":
quit = true
// TODO: more keys
}
}

v.f.Free()
stfl.Reset()
}
37 changes: 37 additions & 0 deletions zzz.go
@@ -0,0 +1,37 @@
package main

import (
"flag"
"os"
"fmt"
)

type ServerInfo struct {
Server string
Port int
Nick string
}

func main() {
info := ServerInfo{ "", 6767, "" }

flag.IntVar(&info.Port, "port", 6767, "IRC server port")
flag.StringVar(&info.Server, "server", "", "IRC server hostname")
flag.StringVar(&info.Nick, "nick", os.Getenv("USER"), "Your nick")

flag.Parse()

if info.Server == "" {
usage()
}

v := CreateView()

v.Run()

}

func usage() {
fmt.Println("usage: zzz -server <server> [-port <port>] [-nick <nick>]")
os.Exit(1)
}

0 comments on commit 0771ccc

Please sign in to comment.