cli

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package cli assembles the ytb command tree on top of the youtube library and the any-cli/kit framework. The record operations are declared once in the youtube domain (so the same definitions drive the CLI, the serve and mcp surfaces, and an ant host); the media, transcript, local-store, and config commands are escape-hatch kit.Command commands that share the run state through the context with appFromCtx.

Index

Constants

This section is empty.

Variables

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

Build metadata, set via -ldflags at release time.

Functions

func NewApp added in v0.2.0

func NewApp() *kit.App

NewApp builds the kit application: identity, the youtube global flags, the record operations and client factory (installed by the domain, the same as an ant host gets), and the escape-hatch commands.

Types

type App

type App struct {
	Cfg    youtube.Config
	Client *youtube.Client
	Out    *render.Renderer

	DataDir string

	Limit    int
	MaxPages int
	Workers  int

	YtDlpBin  string
	FFmpegBin string
	// contains filtered or unexported fields
}

App is the run state an escape-hatch command works through. The record operations live in the youtube domain and receive the *youtube.Client by injection; the escape-hatch commands (download, transcript text, the local store, config) need more than the client, so they rebuild this state from the run context with appFromCtx and share the same renderer, limit, and pacing.

func (*App) Line added in v0.2.0

func (a *App) Line(s string) error

Line prints a raw line of text to stdout, for the transcript body, lyrics, and the store path, which are plain text rather than records.

func (*App) PageOptions

func (a *App) PageOptions(enrich bool) youtube.PageOptions

PageOptions builds a PageOptions from the resolved -n / --max-pages values.

func (*App) RequireStore

func (a *App) RequireStore() (*youtube.Store, error)

RequireStore returns the typed crawl store. It exists for the commands whose whole job is the store; the store always opens at the fixed path, so this no longer fails for a missing flag.

func (*App) Store

func (a *App) Store() (*youtube.Store, error)

Store opens (once) and returns the typed crawl store, creating the data dir.

func (*App) StorePath added in v0.2.0

func (a *App) StorePath() string

StorePath is the fixed location of the typed crawl store, under the data dir. Unlike kit's generic --db record tee, this store carries the rich youtube schema the crawl, queue, export, and db commands read and write.

type Row

type Row = render.Record

Row is one output record: an ordered set of named columns plus the original value used by json/jsonl and templates. It is kit's render.Record, so the row builders feed straight into the shared renderer with no per-format code.

Jump to

Keyboard shortcuts

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