From edbcf6f9a2c71c4922f0c7d7983502815a051f53 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 5 Apr 2022 19:28:25 -0400 Subject: [PATCH] fix: tui initial repo --- internal/tui/session.go | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/internal/tui/session.go b/internal/tui/session.go index 2b6db15b1..7501769e1 100644 --- a/internal/tui/session.go +++ b/internal/tui/session.go @@ -2,34 +2,27 @@ package tui import ( "fmt" - "net/url" - "strings" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/soft-serve/internal/config" "github.com/gliderlabs/ssh" ) +// SessionHandler handles the bubble tea session. func SessionHandler(cfg *config.Config) func(ssh.Session) (tea.Model, []tea.ProgramOption) { return func(s ssh.Session) (tea.Model, []tea.ProgramOption) { + pty, _, active := s.Pty() + if !active { + fmt.Println("not active") + return nil, nil + } cmd := s.Command() scfg := &SessionConfig{Session: s} switch len(cmd) { case 0: scfg.InitialRepo = "" case 1: - p, err := url.Parse(cmd[0]) - if err != nil || strings.Contains(p.Path, "/") { - return nil, nil - } scfg.InitialRepo = cmd[0] - default: - return nil, nil - } - pty, _, active := s.Pty() - if !active { - fmt.Println("not active") - return nil, nil } scfg.Width = pty.Window.Width scfg.Height = pty.Window.Height