Documentation ¶
Overview ¶
Package flag provides the command flags handlers.
Package flag provides the command flags handlers.
Index ¶
- Variables
- func Args(cmd *cobra.Command, args ...string) ([]string, *convert.Convert, sample.Flags, error)
- func Controls(p *[]string, cc *cobra.Command)
- func Default() encoding.Encoding
- func Encode(p *string, cc *cobra.Command)
- func EndOfFile(flags convert.Flag) bool
- func Help(cmd *cobra.Command, args ...string) error
- func InputOriginal(cmd *cobra.Command, dfault string) (sample.Flags, error)
- func OG(p *bool, cc *cobra.Command) error
- func OpenSample(name string, c *convert.Convert, f sample.Flags) ([]byte, error)
- func ReadArgument(arg string, c *convert.Convert, f sample.Flags) ([]byte, error)
- func SwapChars(p *[]string, cc *cobra.Command)
- func Width(p *int, cc *cobra.Command)
- type Command
- type Views
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrHide = errors.New("could not hide the flag")
var ErrNames = errors.New("ignoring [filenames]")
var Hex struct { Raw bool // raw output }
Hex handles the dec and hex "raw" flag.
var Info struct { Checksum bool // show legacy checksums Format string // output format }
Info handles the info "format" flag.
Functions ¶
func Default ¶
Default returns a default encoding when the "input" flag is unused. If the input is a pipe, then the default encoding is UTF-16. Otherwise, the default encoding is CodePage437.
func EndOfFile ¶
EndOfFile reports whether end-of-file control flag was requested.
Example ¶
package main import ( "fmt" "os" "github.com/bengarrett/retrotxtgo/cmd/internal/flag" "github.com/bengarrett/retrotxtgo/convert" ) func main() { var f convert.Flag f.Controls = []string{"eof"} fmt.Fprint(os.Stdout, flag.EndOfFile(f)) }
Output: true
func InputOriginal ¶ added in v0.7.0
InputOriginal applies the "input" and the (hidden) "original" encoding flag values to the sample data.
func OpenSample ¶
OpenSample returns the content of the named embed sample file given via an argument.
func ReadArgument ¶
ReadArgument returns the content of argument supplied filepath, embed sample file or piped data.
Types ¶
type Command ¶
type Command struct {
Tester bool // internal automated tester
}
Command flags for the main cmd.
var Cmd Command
Cmd returns the flags for the main cmd.
type Views ¶
type Views struct { Input string // input character encoding used by the files Controls []string // control codes to implement Swap []string // swap out these characters with Unicode control pictures Width int // maximum document character/column width Original bool // output the sample's original character encoding to stdout }
Views handles the view command flags.