33 lines
537 B
Go
33 lines
537 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/barakmich/kubelwagen"
|
|
)
|
|
|
|
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)
|
|
}
|