Skip to content

Commit

Permalink
feat: emit explicit errors for the service command on unsupported OSes
Browse files Browse the repository at this point in the history
  • Loading branch information
micah-yeager committed Aug 22, 2024
1 parent 9f0f22c commit 322f2a3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cmd/cloudflared/generic_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,36 @@
package main

import (
"fmt"
"os"

cli "github.com/urfave/cli/v2"
)

func runApp(app *cli.App, graceShutdownC chan struct{}) {
app.Commands = append(app.Commands, &cli.Command{
Name: "service",
Usage: "Manages the cloudflared system service (not supported on this operating system)",
Subcommands: []*cli.Command{
{
Name: "install",
Usage: "Install cloudflared as a system service (not supported on this operating system)",
Action: cliutil.ConfiguredAction(installGenericService),
},
{
Name: "uninstall",
Usage: "Uninstall the cloudflared service (not supported on this operating system)",
Action: cliutil.ConfiguredAction(uninstallGenericService),
},
},
})
app.Run(os.Args)
}

func installGenericService(c *cli.Context) error {
return fmt.Errorf("service installation is not supported on this operating system")
}

func uninstallGenericService(c *cli.Context) error {
return fmt.Errorf("service uninstallation is not supported on this operating system")
}

0 comments on commit 322f2a3

Please sign in to comment.