cli

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package cli holds the cobra commands. Each file registers its commands with register(), so new commands (phase 2: wait-new, watch, hook) need no edits here.

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "dev"
	Commit  = ""
	Date    = ""
)

Build info, set with -ldflags "-X …".

Functions

This section is empty.

Types

type App

type App struct {
	Paths  config.Paths
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader

	// Connect runs fn on an authorised session (tgclient.RunSession).
	Connect func(ctx context.Context, opts tgclient.Options, fn func(context.Context, tgclient.Telegram) error) error
	// Raw runs fn on a bare connection (tgclient.Run); used by auth and doctor.
	Raw func(ctx context.Context, opts tgclient.Options, fn func(context.Context, *tgclient.Conn) error) error

	// StdinIsTerminal reports whether prompts can be shown.
	StdinIsTerminal func() bool
	// ReadSecret reads a secret line without echo when on a terminal.
	ReadSecret func(prompt string) (string, error)

	// Now, Sleep and Getenv default to the real clock and environment when nil.
	Now    func() time.Time
	Sleep  func(ctx context.Context, d time.Duration) error
	Getenv func(key string) string
}

App carries I/O and the Telegram connectors; tests swap them for fakes.

func New

func New() (*App, error)

New returns an App wired to the real terminal and Telegram.

func (*App) Execute

func (a *App) Execute(ctx context.Context, args []string) int

Execute runs args and returns the process exit code.

func (*App) Root

func (a *App) Root() *cobra.Command

Root builds the command tree.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL