Skip to content

Commit 467d6e7

Browse files
Brandon Honeycuttclaude
andcommitted
feat: add --version flag to CLI
Add support for --version flag that displays the application version. The version is set via ldflags during build and defaults to "dev" for development builds. This resolves CI failures where the binary test was checking for --version support. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d42780e commit 467d6e7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cmd/hosts-manager/main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var (
2020
cfg *config.Config
2121
verbose bool
2222
dryRun bool
23+
version = "dev" // Will be overridden by ldflags during build
2324
)
2425

2526
func main() {
@@ -42,10 +43,11 @@ func main() {
4243
}
4344

4445
rootCmd := &cobra.Command{
45-
Use: "hosts-manager",
46-
Short: "Cross-platform hosts file manager",
47-
Long: `hosts-manager is a cross-platform CLI tool for managing your hosts file.
46+
Use: "hosts-manager",
47+
Short: "Cross-platform hosts file manager",
48+
Long: `hosts-manager is a cross-platform CLI tool for managing your hosts file.
4849
It provides a template system, backup/restore, interactive TUI mode, and more.`,
50+
Version: version,
4951
}
5052
// Ensure proper initialization and configuration validation
5153

0 commit comments

Comments
 (0)