34 lines
664 B
Go
34 lines
664 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var version = "0.0.7"
|
|
|
|
var configPath string
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: "unitdore",
|
|
Short: "A door you open and close for container units",
|
|
Long: `Unitdore manages container units via systemd.
|
|
|
|
It discovers running containers, stores them in a config file,
|
|
and generates + manages systemd .service units for each one.`,
|
|
Version: version,
|
|
}
|
|
|
|
func Execute() {
|
|
if err := rootCmd.Execute(); err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.PersistentFlags().StringVar(&configPath, "config", "/etc/unitdore/units.yaml", "path to units config file")
|
|
}
|