tlcli

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Overview

Package tlcli provides helper utilities for command line programs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CobraHelper

func CobraHelper(r Runner, pc string, subc string) *cobra.Command

func ReadFileLines

func ReadFileLines(fn string) ([]string, error)

func RunWithArgs

func RunWithArgs(ctx context.Context, r Runner, args []string) error

Types

type GenDocCommand

type GenDocCommand struct {
	Outpath string
	Delete  bool
	Command *cobra.Command
}

func (*GenDocCommand) AddFlags

func (cmd *GenDocCommand) AddFlags(fl *pflag.FlagSet)

func (*GenDocCommand) HelpDesc

func (cmd *GenDocCommand) HelpDesc() (string, string)

func (*GenDocCommand) Parse

func (cmd *GenDocCommand) Parse(args []string) error

func (*GenDocCommand) Run

func (cmd *GenDocCommand) Run(ctx context.Context) error

type NArgs

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

func NewNArgs

func NewNArgs(v []string) *NArgs

func (*NArgs) Arg

func (fl *NArgs) Arg(i int) string

func (*NArgs) Args

func (fl *NArgs) Args() []string

func (*NArgs) NArg

func (fl *NArgs) NArg() int

type Runner

type Runner interface {
	AddFlags(*pflag.FlagSet)
	Parse([]string) error
	Run(context.Context) error
}

type TwoFieldLine added in v1.3.1

type TwoFieldLine struct {
	Field1 string
	Field2 string
}

TwoFieldLine represents a line with two whitespace-separated fields.

func ReadFileTwoFields added in v1.3.1

func ReadFileTwoFields(fn string) ([]TwoFieldLine, error)

ReadFileTwoFields reads a file and parses each line into two fields separated by whitespace or comma. Empty lines and lines with only whitespace are skipped. If a line has only one field, Field2 will be empty.

Jump to

Keyboard shortcuts

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