diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-02 08:46:56 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-02 08:46:56 +0200 |
| commit | 717cf6a47cd19cc284b023825a3bac3272ebe171 (patch) | |
| tree | 5be553754917157311d107538a99e34b2f8aa839 /internal/flags | |
| parent | b3327d17f9f5c7080b05d6d5457cf25550d40ad9 (diff) | |
Make --open a command template with no defaults
Diffstat (limited to 'internal/flags')
| -rw-r--r-- | internal/flags/flags.go | 4 | ||||
| -rw-r--r-- | internal/flags/flags_test.go | 11 |
2 files changed, 2 insertions, 13 deletions
diff --git a/internal/flags/flags.go b/internal/flags/flags.go index c4ee7d2..a732c3a 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -65,7 +65,6 @@ type Flags struct { FlamegraphEnable bool LiveFlamegraph bool LiveInterval time.Duration - OpenLiveBrowser bool OpenCommand string FlamegraphName string TUIExportEnable bool @@ -124,8 +123,7 @@ func parse() error { flag.BoolVar(&singleton.FlamegraphEnable, "flamegraph", false, "Enable flamegraph builder") flag.BoolVar(&singleton.LiveFlamegraph, "live", false, "Enable live flamegraph mode") flag.DurationVar(&singleton.LiveInterval, "live-interval", 200*time.Millisecond, "Live flamegraph refresh interval") - flag.BoolVar(&singleton.OpenLiveBrowser, "open", false, "Auto-open live flamegraph URL in a browser (used with -live)") - flag.StringVar(&singleton.OpenCommand, "open-cmd", "", "Custom command to open live flamegraph URL; use {url} placeholder or URL is appended") + flag.StringVar(&singleton.OpenCommand, "open", "", "Command to open live flamegraph URL (used with -live); use {url} placeholder or URL is appended") flag.StringVar(&singleton.FlamegraphName, "name", "default", "Name of the flamegraph, used to generate the SVG file") flag.BoolVar(&singleton.TUIExportEnable, "tuiExport", true, "Enable writing TUI snapshot export files") diff --git a/internal/flags/flags_test.go b/internal/flags/flags_test.go index 3fa74c6..32af4bd 100644 --- a/internal/flags/flags_test.go +++ b/internal/flags/flags_test.go @@ -69,9 +69,6 @@ func TestParseLiveFlagsAndInterval(t *testing.T) { if got := int(pidFilter.Load()); got != 1234 { t.Fatalf("global pid filter = %d, want 1234", got) } - if cfg.OpenLiveBrowser { - t.Fatalf("expected open-live disabled by default") - } if cfg.OpenCommand != "" { t.Fatalf("expected empty open command by default") } @@ -89,25 +86,19 @@ func TestParseLiveDefaults(t *testing.T) { if cfg.LiveInterval != 200*time.Millisecond { t.Fatalf("default live interval = %v, want %v", cfg.LiveInterval, 200*time.Millisecond) } - if cfg.OpenLiveBrowser { - t.Fatalf("expected open-live disabled by default") - } if cfg.OpenCommand != "" { t.Fatalf("expected empty open command by default") } } func TestParseOpenFlags(t *testing.T) { - cfg, err := parseForTest(t, "-live", "-open", "-open-cmd", "chromium --new-window") + cfg, err := parseForTest(t, "-live", "-open", "chromium --new-window") if err != nil { t.Fatalf("parse returned error: %v", err) } if !cfg.LiveFlamegraph { t.Fatalf("expected live mode enabled") } - if !cfg.OpenLiveBrowser { - t.Fatalf("expected -open to enable live browser open") - } if cfg.OpenCommand != "chromium --new-window" { t.Fatalf("open command = %q, want %q", cfg.OpenCommand, "chromium --new-window") } |
