Skip to content

Commit

Permalink
fix(cli): use ctrl+c instead c to early break collecting when in stat…
Browse files Browse the repository at this point in the history
… batch mode
  • Loading branch information
hengyoush committed Oct 21, 2024
1 parent 0a40a97 commit d9e9ef8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions agent/render/stat/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (m *model) updateStatTable(msg tea.Msg) (tea.Model, tea.Cmd) {
m.windownSizeMsg = msg
case tea.KeyMsg:
switch msg.String() {
case "c":
case "ctrl+c":
if m.options.EnableBatchModel() {
if len(m.statTable.Rows()) == 0 {
m.options.HavestSignal <- struct{}{}
Expand All @@ -287,11 +287,11 @@ func (m *model) updateStatTable(msg tea.Msg) (tea.Model, tea.Cmd) {
m.connstats = &connstats
m.updateRowsInTable()
}
break
}
break
}
fallthrough
case "esc", "q", "ctrl+c":
case "esc", "q":
return m, tea.Quit
case "1", "2", "3", "4", "5", "6", "7", "8":
i, err := strconv.Atoi(strings.TrimPrefix(msg.String(), "ctrl+"))
Expand Down Expand Up @@ -389,7 +389,7 @@ func (m *model) viewStatTable() string {
s += rc.BaseTableStyle.Render(m.statTable.View()) + "\n " + m.statTable.HelpView() + "\n\n " + m.additionHelp.View(sortByKeyMap)
} else {
s += fmt.Sprintf("\n %s Collecting %d/%d\n\n %s\n\n", m.spinner.View(), m.options.CurrentReceivedSamples(), m.options.TargetSamples,
titleStyle.Render("Press `c` to display collected events"))
titleStyle.Render("Press `Ctrl+C` to display collected events"))
}
} else {
s = fmt.Sprintf("\n %s Events received: %d\n\n", m.spinner.View(), totalCount)
Expand Down

0 comments on commit d9e9ef8

Please sign in to comment.