summaryrefslogtreecommitdiff
path: root/internal/tui/tui.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-24 17:27:10 +0200
committerPaul Buetow <paul@buetow.org>2026-02-24 17:27:10 +0200
commitda8ddf1cf415f1754c3fe71f3f342327ad00e91e (patch)
treeaf3ba70015cf7db4bfd3a2adcb9334417740e4f3 /internal/tui/tui.go
parent2ae0b33c9f196634eaa55bd6997d1feae9147385 (diff)
tui: add toggle to disable snapshot export file writes
Diffstat (limited to 'internal/tui/tui.go')
-rw-r--r--internal/tui/tui.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/internal/tui/tui.go b/internal/tui/tui.go
index 143cf02..4433172 100644
--- a/internal/tui/tui.go
+++ b/internal/tui/tui.go
@@ -99,13 +99,17 @@ func NewModel(initialPID int, startTrace TraceStarter) Model {
if startTrace == nil {
startTrace = defaultTraceStarter
}
+ keys := Keys
+ if !flags.Get().TUIExportEnable {
+ keys.Export = key.NewBinding()
+ }
model := Model{
screen: ScreenPIDPicker,
pidPicker: pidpicker.New(),
- dashboard: dashboardui.NewModel(lateBoundDashboardSource{}),
+ dashboard: dashboardui.NewModelWithConfig(lateBoundDashboardSource{}, 1000, keys),
exporter: tuiexport.NewModel(),
- keys: Keys,
+ keys: keys,
spin: spin,
startTrace: startTrace,
}
@@ -151,7 +155,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if !m.exporter.Visible() && m.showHelp {
return m, nil
}
- if m.screen == ScreenDashboard && !m.attaching && m.lastErr == nil && key.Matches(msg, m.keys.Export) && !m.exporter.Visible() {
+ if flags.Get().TUIExportEnable && m.screen == ScreenDashboard && !m.attaching && m.lastErr == nil && key.Matches(msg, m.keys.Export) && !m.exporter.Visible() {
m.exporter = m.exporter.Open()
return m, nil
}
@@ -299,6 +303,9 @@ func (m Model) View() string {
func runExportCmd(option tuiexport.Option, snap *statsengine.Snapshot) tea.Cmd {
return func() tea.Msg {
+ if !flags.Get().TUIExportEnable {
+ return tuiexport.FailedMsg{Err: errors.New("tui export is disabled by -tuiExport=false")}
+ }
switch option {
case tuiexport.OptionCSV:
path, err := exportSnapshotCSV(snap)