Add cobra, move the server code into its own package
This commit is contained in:
parent
bb729a5c8e
commit
e63c012aad
57 changed files with 6910 additions and 145 deletions
31
commands/name_pending.go
Normal file
31
commands/name_pending.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"github.com/khlieng/name_pending/Godeps/_workspace/src/github.com/spf13/cobra"
|
||||
|
||||
"github.com/khlieng/name_pending/server"
|
||||
"github.com/khlieng/name_pending/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "name_pending",
|
||||
Long: "Web-based IRC client in Go.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
storage.Initialize(development)
|
||||
server.Run(port, development)
|
||||
},
|
||||
}
|
||||
|
||||
development bool
|
||||
port int
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.Flags().BoolVarP(&development, "dev", "d", false, "development mode")
|
||||
rootCmd.Flags().IntVarP(&port, "port", "p", 1337, "port to listen on")
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
rootCmd.Execute()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue