diff --git a/Gosl.go b/Gosl.go new file mode 100644 index 0000000..0c3b50a --- /dev/null +++ b/Gosl.go @@ -0,0 +1,17 @@ +package main // code.bitsetter.de/fun/gosl + +import ( + "runtime" + + "code.bitsetter.de/fun/gosl/cmd" +) + +func main() { + // Max out processor usage: + // since go 1.5 it's the default to use all available cores, + // let's stay compatible to go <= 1.4 + runtime.GOMAXPROCS(runtime.NumCPU()) + + // let each cmd handle itself + cmd.Execute() +} diff --git a/cmd/Client.go b/cmd/Client.go new file mode 100644 index 0000000..0916c68 --- /dev/null +++ b/cmd/Client.go @@ -0,0 +1,22 @@ +package cmd // code.bitsetter.de/fun/gosl/cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var cmdClient = &cobra.Command{ + Use: "client", + Short: "Runs Gosl as a client", + Long: "Runs Gosl as a client", + // Run: +} + +func runClient(cmd *cobra.Command, args []string) { + fmt.Println("running client ...") +} + +func init() { + cmdClient.Run = runClient +} diff --git a/cmd/Cmd.go b/cmd/Cmd.go new file mode 100644 index 0000000..7659c68 --- /dev/null +++ b/cmd/Cmd.go @@ -0,0 +1,24 @@ +package cmd // code.bitsetter.de/fun/gosl/cmd + +import ( + "os" + + "github.com/spf13/cobra" +) + +var cmdGosl = &cobra.Command{ + Use: "gosl [command]", + Short: "Run a gosl instance", + Long: `Run a gosl server or client." + +For further instructions run 'gosl help [command]' +`, +} + +func Execute() { + cmdGosl.AddCommand(cmdServer) + cmdGosl.AddCommand(cmdClient) + if err := cmdGosl.Execute(); err != nil { + os.Exit(-1) + } +} diff --git a/cmd/Server.go b/cmd/Server.go new file mode 100644 index 0000000..9071ffb --- /dev/null +++ b/cmd/Server.go @@ -0,0 +1,22 @@ +package cmd // code.bitsetter.de/fun/gosl/cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var cmdServer = &cobra.Command{ + Use: "server", + Short: "Runs Gosl as a server", + Long: "Runs Gosl as a server", + // Run: +} + +func runServer(cmd *cobra.Command, args []string) { + fmt.Println("running server ...") +} + +func init() { + cmdServer.Run = runServer +} diff --git a/data/Screen.go b/data/Screen.go new file mode 100644 index 0000000..3e43793 --- /dev/null +++ b/data/Screen.go @@ -0,0 +1,6 @@ +package data // code.bitsetter.de/fun/gosl/data + +type Screen struct { + w, h int + data []rune +} diff --git a/gosl b/gosl new file mode 100755 index 0000000..de5ef1e Binary files /dev/null and b/gosl differ