diff --git a/commands/daemon.go b/commands/daemon.go index 41b3c60..dbf49cc 100644 --- a/commands/daemon.go +++ b/commands/daemon.go @@ -8,5 +8,6 @@ var DaemonCommand *cli.Command = &cli.Command{ Subcommands: []*cli.Command{ DaemonInstallCommand, DaemonUninstallCommand, + DaemonReinstallCommand, }, } diff --git a/commands/daemon.reinstall.go b/commands/daemon.reinstall.go new file mode 100644 index 0000000..3a5cbc7 --- /dev/null +++ b/commands/daemon.reinstall.go @@ -0,0 +1,31 @@ +package commands + +import ( + "github.com/gookit/color" + "github.com/urfave/cli/v2" +) + +var DaemonReinstallCommand = &cli.Command{ + Name: "reinstall", + Usage: "Reinstall the shelltime daemon service (uninstall then install)", + Action: commandDaemonReinstall, +} + +func commandDaemonReinstall(c *cli.Context) error { + color.Yellow.Println("🔄 Starting daemon service reinstallation...") + + // First, uninstall the existing service + color.Yellow.Println("🗑 Uninstalling existing daemon service...") + if err := commandDaemonUninstall(c); err != nil { + return err + } + + // Then, install the service + color.Yellow.Println("📦 Installing daemon service...") + if err := commandDaemonInstall(c); err != nil { + return err + } + + color.Green.Println("✅ Daemon service has been successfully reinstalled!") + return nil +} \ No newline at end of file