add fang
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/LazyBachelor/LazyPM/internal/service"
|
"github.com/LazyBachelor/LazyPM/internal/service"
|
||||||
|
"github.com/charmbracelet/fang"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@@ -15,7 +19,9 @@ var rootCmd = &cobra.Command{
|
|||||||
|
|
||||||
func Execute(services *service.Services) error {
|
func Execute(services *service.Services) error {
|
||||||
SetServices(services)
|
SetServices(services)
|
||||||
return rootCmd.Execute()
|
return fang.Execute(context.Background(), rootCmd,
|
||||||
|
fang.WithColorSchemeFunc(fang.AnsiColorScheme),
|
||||||
|
fang.WithNotifySignal(os.Interrupt, os.Kill))
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetServices(services *service.Services) {
|
func SetServices(services *service.Services) {
|
||||||
@@ -25,7 +31,8 @@ func SetServices(services *service.Services) {
|
|||||||
|
|
||||||
func ExecuteWithArgs(args []string) error {
|
func ExecuteWithArgs(args []string) error {
|
||||||
rootCmd.SetArgs(args)
|
rootCmd.SetArgs(args)
|
||||||
return rootCmd.Execute()
|
return fang.Execute(context.Background(), rootCmd,
|
||||||
|
fang.WithColorSchemeFunc(fang.AnsiColorScheme))
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
Reference in New Issue
Block a user