carve out cmd, stub server impl

This commit is contained in:
Barak Michener 2018-03-28 14:29:55 -07:00
parent 51fa79ef2f
commit 90aa93a1d7
64 changed files with 10564 additions and 3 deletions

View file

@ -1,6 +1,10 @@
package main
import "github.com/spf13/cobra"
import (
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "kubelwagen",
@ -9,4 +13,7 @@ var rootCmd = &cobra.Command{
Run: rootRun,
}
func rootRun(cmd *cobra.Command)
func rootRun(cmd *cobra.Command, args []string) {
cmd.Usage()
os.Exit(1)
}

31
cmd/kubelwagen/serve.go Normal file
View file

@ -0,0 +1,31 @@
package main
import (
"os"
"github.com/spf13/cobra"
)
var (
hostport string
)
func init() {
rootCmd.AddCommand(serveCmd)
serveCmd.PersistentFlags().StringVar(&hostport, "listen", "0.0.0.0:8889", "Host and port to listen on")
}
var serveCmd = &cobra.Command{
Use: "serve DIR",
Short: "Create a FUSE mount at DIR",
Run: serveRun,
}
func serveRun(cmd *cobra.Command, args []string) {
if len(args) != 1 {
cmd.Usage()
os.Exit(1)
}
dir := args[0]
kubelwagen.Serve(hostport, dir)
}