You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
Version string = "dev"
|
|
|
|
)
|
|
|
|
|
|
|
|
func actionServ(c *cli.Context) error {
|
|
|
|
fmt.Println("added serv: ", c.Args().First())
|
|
|
|
|
|
|
|
log.Fatal(http.ListenAndServe(":8000", nil))
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func actionStatus(c *cli.Context) error {
|
|
|
|
log.Println("Status")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
app := cli.NewApp()
|
|
|
|
app.Name = "gosuv"
|
|
|
|
app.Version = Version
|
|
|
|
app.Usage = "golang port of python-supervisor"
|
|
|
|
app.Commands = []cli.Command{
|
|
|
|
{
|
|
|
|
Name: "serv",
|
|
|
|
Usage: "Should only called by itself",
|
|
|
|
Action: actionServ,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "status",
|
|
|
|
Aliases: []string{"st"},
|
|
|
|
Usage: "Show program status",
|
|
|
|
Action: actionStatus,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|