inits/pkg/cmd/init/init.go

35 lines
704 B
Go
Raw Normal View History

2019-03-08 01:21:29 +00:00
package cmdinit
import (
"os"
"strings"
"github.com/spf13/cobra"
2024-01-20 13:20:51 +00:00
initboot "novit.tech/direktil/inits/pkg/cmd/init/boot"
initdefault "novit.tech/direktil/inits/pkg/cmd/init/default"
initservice "novit.tech/direktil/inits/pkg/cmd/init/service"
2019-03-08 01:21:29 +00:00
)
func Command() (c *cobra.Command) {
c = &cobra.Command{
Use: "init",
Short: "init stages",
PersistentPreRun: func(_ *cobra.Command, _ []string) {
// set a reasonable path
os.Setenv("PATH", strings.Join([]string{
"/usr/local/bin:/usr/local/sbin",
"/usr/bin:/usr/sbin",
"/bin:/sbin",
}, ":"))
},
}
c.AddCommand(initboot.Command())
c.AddCommand(initdefault.Command())
c.AddCommand(initservice.Command())
return
}