runLeanTUI builds the App and drives the standalone lean TUI, used when --lean is set. Unlike the full TUI it renders to the normal terminal buffer (no alternate screen) and sends the first/queued messages itself rather than through the App's bubbletea command pipeline.
(ctx context.Context, rt runtime.Runtime, sess *session.Session, cleanup func(), args []string, opts ...app.Opt)
| 950 | // (no alternate screen) and sends the first/queued messages itself rather than |
| 951 | // through the App's bubbletea command pipeline. |
| 952 | func (f *runExecFlags) runLeanTUI(ctx context.Context, rt runtime.Runtime, sess *session.Session, cleanup func(), args []string, opts ...app.Opt) error { |
| 953 | if gen := rt.TitleGenerator(ctx); gen != nil { |
| 954 | opts = append(opts, app.WithTitleGenerator(gen)) |
| 955 | } |
| 956 | a := app.New(ctx, rt, sess, opts...) |
| 957 | a.Start(ctx) |
| 958 | |
| 959 | firstMessage, err := readInitialMessage(args) |
| 960 | if err != nil { |
| 961 | return err |
| 962 | } |
| 963 | var queued []string |
| 964 | if len(args) > 2 { |
| 965 | queued = args[2:] |
| 966 | } |
| 967 | if cleanup == nil { |
| 968 | cleanup = func() {} |
| 969 | } |
| 970 | |
| 971 | // Prefer the session's working directory so the lean status bar shows |
| 972 | // where the tools operate — e.g. the worktree from --worktree, not the |
| 973 | // process CWD it was launched from. |
| 974 | wd := sess.WorkingDir |
| 975 | if wd == "" { |
| 976 | wd, _ = os.Getwd() |
| 977 | } |
| 978 | return leantui.Run(ctx, leantui.Config{ |
| 979 | App: a, |
| 980 | WorkingDir: wd, |
| 981 | Cleanup: cleanup, |
| 982 | FirstMessage: firstMessage, |
| 983 | FirstMessageAttachment: f.attachmentPath, |
| 984 | QueuedMessages: queued, |
| 985 | AppName: f.appName, |
| 986 | DisabledCommands: f.disabledCommands, |
| 987 | }) |
| 988 | } |
| 989 | |
| 990 | func (f *runExecFlags) buildAppOpts(args []string) ([]app.Opt, error) { |
| 991 | firstMessage, err := readInitialMessage(args) |
no test coverage detected