35 lines
677 B
Go
35 lines
677 B
Go
package main
|
|
|
|
import (
|
|
"backlight-control/cmd/set"
|
|
"backlight-control/cmd/status"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var rootCmd *cobra.Command
|
|
|
|
func main() {
|
|
rootCmd = &cobra.Command{
|
|
Use: "backlight-control",
|
|
Short: "backlight control tool",
|
|
SilenceUsage: true,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
cmd.Help()
|
|
},
|
|
}
|
|
|
|
rootCmd.PersistentFlags().String("path", "", "control file directory path (/path/to/dir/{brightness,max_brightness})")
|
|
|
|
if err := rootCmd.MarkPersistentFlagRequired("path"); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
set.NewCommand(rootCmd)
|
|
status.NewCommand(rootCmd)
|
|
|
|
if err := rootCmd.Execute(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|