feat: emit explicit errors for the service
command on unsupported OSes
#1291
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Per the contribution guidelines, this seemed to me like a small enough change to not warrant an issue before creating this pull request. Let me know if you'd like me to create one anyway.
Background
While working with
cloudflared
on FreeBSD recently, I noticed that there's an inconsistency with the available CLI commands on that OS versus others — namely that theservice
command doesn't exist at all for operating systems other than Linux, macOS, and Windows.Contrast
cloudflared --help
output on macOS versus FreeBSD (truncated to focus on theCOMMANDS
section):Current help output on macOS:
Current help output on FreeBSD:
This omission has caused confusion for users (including me), especially since the provided command in the Cloudflare Zero Trust dashboard returns a seemingly-unrelated error message:
Contribution
This pull request adds a "stub"
service
command (including the usual subcommands available on other OSes) to explicitly declare it as unsupported on the operating system.New help output on FreeBSD (and other operating systems where service management is unsupported):
New outputs when running the service management subcommands:
This keeps the available commands consistent until proper service management support can be added for these otherwise-supported operating systems.
I'm more than happy to make any adjustments to the pull request — just let me know!