Revert "feat(crew): cycle across all rigs with C-b n/p"
This reverts commit 601f8ab4d3.
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// cycleCrewSession switches to the next or previous crew session across ALL rigs.
|
||||
// cycleCrewSession switches to the next or previous crew session in the same rig.
|
||||
// direction: 1 for next, -1 for previous
|
||||
func cycleCrewSession(direction int) error {
|
||||
// Get current session (uses existing function from handoff.go)
|
||||
@@ -20,20 +20,20 @@ func cycleCrewSession(direction int) error {
|
||||
return fmt.Errorf("not in a tmux session")
|
||||
}
|
||||
|
||||
// Verify we're in a crew session
|
||||
_, _, ok := parseCrewSessionName(currentSession)
|
||||
// Parse rig name from current session
|
||||
rigName, _, ok := parseCrewSessionName(currentSession)
|
||||
if !ok {
|
||||
return fmt.Errorf("not in a crew session (expected gt-<rig>-crew-<name>)")
|
||||
}
|
||||
|
||||
// Find all crew sessions across all rigs
|
||||
sessions, err := findAllCrewSessions()
|
||||
// Find all crew sessions for this rig
|
||||
sessions, err := findRigCrewSessions(rigName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("listing sessions: %w", err)
|
||||
}
|
||||
|
||||
if len(sessions) == 0 {
|
||||
return fmt.Errorf("no crew sessions found")
|
||||
return fmt.Errorf("no crew sessions found for rig %s", rigName)
|
||||
}
|
||||
|
||||
// Sort for consistent ordering
|
||||
|
||||
@@ -294,28 +294,3 @@ func findRigCrewSessions(rigName string) ([]string, error) {
|
||||
// (alphabetical by session name means alphabetical by crew name)
|
||||
return sessions, nil
|
||||
}
|
||||
|
||||
// findAllCrewSessions returns all crew sessions across all rigs, sorted alphabetically.
|
||||
// Uses tmux list-sessions to find sessions matching gt-*-crew-* pattern.
|
||||
func findAllCrewSessions() ([]string, error) {
|
||||
cmd := exec.Command("tmux", "list-sessions", "-F", "#{session_name}")
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
// No tmux server or no sessions
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var sessions []string
|
||||
|
||||
for _, line := range strings.Split(strings.TrimSpace(string(out)), "\n") {
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
// Match gt-<rig>-crew-<name> pattern
|
||||
if strings.HasPrefix(line, "gt-") && strings.Contains(line, "-crew-") {
|
||||
sessions = append(sessions, line)
|
||||
}
|
||||
}
|
||||
|
||||
return sessions, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user