cli

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = time.Second * 30
)

Variables

This section is empty.

Functions

func Getwd

func Getwd() (string, error)

func NewBindingNode

func NewBindingNode(p *hype.Parser, el *hype.Element, whole *binding.Whole) (hype.Node, error)

func NewBindingNodes

func NewBindingNodes(whole *binding.Whole) hype.ParseElementFn

func NewParser

func NewParser(cab fs.FS, ctxPath string, pwd string) (*hype.Parser, error)

func WithTimeout

func WithTimeout(ctx context.Context, timeout time.Duration, f func(context.Context) error) error

func WithinDir

func WithinDir(dir string, f func() error) error

Types

type App

type App struct {
	cleo.Cmd

	Parser *hype.Parser
	// contains filtered or unexported fields
}

func Garlic

func Garlic(root string) (*App, error)

func New

func New(root string) *App

func (*App) Main

func (cmd *App) Main(ctx context.Context, pwd string, args []string) error

func (*App) ScopedPlugins

func (cmd *App) ScopedPlugins() plugins.Plugins

type Binding

type Binding struct {
	*hype.Element

	Whole *binding.Whole
}

func (*Binding) String

func (b *Binding) String() string

type Blog added in v0.5.0

type Blog struct {
	cleo.Cmd

	Timeout time.Duration
	Verbose bool
	// contains filtered or unexported fields
}

func (*Blog) Flags added in v0.5.0

func (cmd *Blog) Flags(stderr io.Writer) (*flag.FlagSet, error)

func (*Blog) Main added in v0.5.0

func (cmd *Blog) Main(ctx context.Context, pwd string, args []string) error

func (*Blog) WithPlugins added in v0.5.0

func (cmd *Blog) WithPlugins(fn plugins.FeederFn) error

type Commander

type Commander = cleo.Commander

type Encode

type Encode struct {
	cleo.Cmd

	File      string        // optional file name to preview
	Timeout   time.Duration // default: 5s
	Parser    *hype.Parser  // If nil, a default parser is used.
	ParseOnly bool          // if true, only parse the file and exit
	// contains filtered or unexported fields
}

func (*Encode) Flags

func (cmd *Encode) Flags() (*flag.FlagSet, error)

func (*Encode) Main

func (cmd *Encode) Main(ctx context.Context, pwd string, args []string) error

func (*Encode) SetParser

func (cmd *Encode) SetParser(p *hype.Parser) error

type Env

type Env struct {
	// contains filtered or unexported fields
}

func (*Env) Getenv

func (e *Env) Getenv(key string) string

func (*Env) Setenv

func (e *Env) Setenv(key string, value string)

type Export

type Export struct {
	cleo.Cmd

	// a folder containing all chapters of a book, for example
	File    string        // optional file name to preview
	OutPath OutPath       // path to a file to write the output on success; default: nil
	Timeout time.Duration // default: 30s
	Parser  *hype.Parser  // If nil, a default parser is used.
	Verbose bool          // default: false
	Format  string        // default:markdown
	// contains filtered or unexported fields
}

func (*Export) Flags

func (cmd *Export) Flags(stderr io.Writer) (*flag.FlagSet, error)

func (*Export) Main

func (cmd *Export) Main(ctx context.Context, pwd string, args []string) error

func (*Export) ScopedPlugins

func (cmd *Export) ScopedPlugins() plugins.Plugins

func (*Export) SetParser

func (cmd *Export) SetParser(p *hype.Parser) error

func (*Export) WithPlugins

func (cmd *Export) WithPlugins(fn plugins.FeederFn) error

type Marked

type Marked struct {
	cleo.Cmd

	// a folder containing all chapters of a book, for example
	ContextPath string
	File        string        // optional file name to preview
	Timeout     time.Duration // default: 5s
	Parser      *hype.Parser  // If nil, a default parser is used.
	ParseOnly   bool          // if true, only parse the file and exit
	Section     int           // default: 1
	Verbose     bool          // default: false
	// contains filtered or unexported fields
}

func (*Marked) Flags

func (cmd *Marked) Flags() (*flag.FlagSet, error)

func (*Marked) Main

func (cmd *Marked) Main(ctx context.Context, pwd string, args []string) error

func (*Marked) ScopedPlugins

func (cmd *Marked) ScopedPlugins() plugins.Plugins

func (*Marked) SetParser

func (cmd *Marked) SetParser(p *hype.Parser) error

func (*Marked) WithPlugins

func (cmd *Marked) WithPlugins(fn plugins.FeederFn) error

type OutPath

type OutPath struct {
	// contains filtered or unexported fields
}

func (*OutPath) Exists

func (o *OutPath) Exists() bool

func (*OutPath) Set

func (o *OutPath) Set(path string) error

func (*OutPath) String

func (o *OutPath) String() string

func (*OutPath) Value

func (o *OutPath) Value() string

type ParserCommander

type ParserCommander interface {
	cleo.Commander
	SetParser(p *hype.Parser) error
}

type Part

type Part binding.Part

func (Part) Children

func (p Part) Children() hype.Nodes

func (Part) String

func (p Part) String() string

type Slides

type Slides struct {
	cleo.Cmd

	// Env to be used by the app
	// If nil, os.Getenv will be used.
	*Env

	// Web app to be used by the app
	slides.App

	Parser *hype.Parser

	// Server to be used by the app
	// If nil, a default server will be created.
	Server *http.Server

	// Port to listen on. Defaults to 3000.
	Port int
	// contains filtered or unexported fields
}

func (*Slides) Describe

func (a *Slides) Describe() string

func (*Slides) Getenv

func (a *Slides) Getenv(key string) (s string)

func (*Slides) Main

func (a *Slides) Main(ctx context.Context, pwd string, args []string) error

func (*Slides) Print

func (a *Slides) Print(w io.Writer) error

func (*Slides) SetIO

func (a *Slides) SetIO(oi iox.IO)

type TOC

type TOC struct {
	cleo.Cmd
}

func (*TOC) Main

func (cmd *TOC) Main(ctx context.Context, pwd string, args []string) error

type VSCode

type VSCode struct {
	cleo.Cmd

	Timeout time.Duration
	Host    string
	Parser  *hype.Parser // If nil, a default parser is used.
	// contains filtered or unexported fields
}

func (*VSCode) Flags

func (cmd *VSCode) Flags() (*flag.FlagSet, error)

func (*VSCode) Main

func (cmd *VSCode) Main(ctx context.Context, pwd string, args []string) error

Jump to

Keyboard shortcuts

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