cmd

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: LGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package cmd handles the terminal interface, user flags and arguments.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHide  = errors.New("could not hide the flag")
	ErrUsage = errors.New("command usage could not display")
)
View Source
var Cmd = &cobra.Command{
	Use:   meta.Bin,
	Short: fmt.Sprintf("Use %s to print plain, BBS era and ANSI textfiles", meta.Name),
	Long: meta.Name + " takes legacy codepage and ANSI encoded textfiles and\n" +
		"prints them to a modern Unicode terminal.",
	Example: fmt.Sprint(example.Cmd),
	RunE: func(cmd *cobra.Command, args []string) error {

		return flag.Help(cmd)
	},
}

Cmd represents the base command when called without any subcommands.

Functions

func Execute

func Execute() error

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func InfoCommand

func InfoCommand() *cobra.Command

func InfoInit

func InfoInit() *cobra.Command

func Init added in v0.1.0

func Init()

func ListCodepages

func ListCodepages() *cobra.Command

func ListCommand

func ListCommand() *cobra.Command

func ListExamples

func ListExamples() *cobra.Command

func ListInit

func ListInit() *cobra.Command

func ListTable

func ListTable() *cobra.Command

func ListTables

func ListTables() *cobra.Command

func Tester

func Tester(c *cobra.Command) *cobra.Command

Tester creates and hides a custom tester flag. It is its own function so it can also be applied to unit tests as well as init.

func ViewCommand

func ViewCommand() *cobra.Command

func ViewInit

func ViewInit() *cobra.Command

Types

type Lists

type Lists int

Lists are the subcommands of the list command.

const (
	Codepages Lists = iota // Codepages list command.
	Examples               // Examples list command.
	Table                  // Table command lists a single table.
	Tables                 // Tables command lists all tables.
)

func (Lists) Command

func (l Lists) Command() *cobra.Command

Command runs one of the list subcommands.

Directories

Path Synopsis
internal
flag
Package flag provides the command flags handlers.
Package flag provides the command flags handlers.
format
Package format handles data outputs.
Package format handles data outputs.
info
Package info provides the info command run function.
Package info provides the info command run function.
view
Package view provides the view command run function.
Package view provides the view command run function.
pkg
example
Package example provides help usage examples for the cmd package.
Package example provides help usage examples for the cmd package.
list
Package list provides the list command run function.
Package list provides the list command run function.
update
Package update provides the ability to check GitHub for the newest release tag.
Package update provides the ability to check GitHub for the newest release tag.
version
Package version provides the stdout template for the version flag.
Package version provides the stdout template for the version flag.

Jump to

Keyboard shortcuts

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