Initial work-in-progress
This commit is contained in:
parent
69f9b3691f
commit
3307087412
|
@ -0,0 +1,37 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type CreateOptions struct {
|
||||
WorkingDirectory string
|
||||
}
|
||||
|
||||
var (
|
||||
createOpts = CreateOptions{}
|
||||
|
||||
createCmd = &cobra.Command{
|
||||
Use: "create <executable>",
|
||||
Short: "creates a new Unit file",
|
||||
Long: `The create command creates a new systemd Unit file`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if len(args) < 1 {
|
||||
return fmt.Errorf("create needs an executable to create a Unit file for")
|
||||
}
|
||||
return executeCreate()
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func executeCreate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
createCmd.PersistentFlags().StringVarP(&createOpts.WorkingDirectory, "workingdir", "w", "", "WorkingDirectory of the service")
|
||||
|
||||
RootCmd.AddCommand(createCmd)
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
RootCmd = &cobra.Command{
|
||||
Use: "service-generator",
|
||||
Short: "service-generator creates systemd Unit files",
|
||||
Long: "service-generator is a convenient little tool to create systemd Unit files",
|
||||
SilenceErrors: false,
|
||||
SilenceUsage: true,
|
||||
}
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := RootCmd.Execute(); err != nil {
|
||||
os.Exit(-1)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue