flags

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleDataFlag

func HandleDataFlag(cmd *cobra.Command, fs afero.Fs) (io.ReadCloser, error)

HandleDataFlag returns an io.ReadCloser for the data specified in the flag. If the data flag is "-", the data will be read from stdin. If the data flag starts with "@", it opens the file specified in the flag. Otherwise, it returns the provided data string.

func HandleEditFlag

func HandleEditFlag(cmd *cobra.Command, fs afero.Fs, cfg *config.Config) (editor.Editor, error)

HandleEditFlag returns an editor.Editor instance if the edit flag is set. Otherwise it returns nil. The actual editor used is determined by configuration or, if not set, nano is used by default.

func HandleOutputFlag

func HandleOutputFlag(cmd *cobra.Command, fs afero.Fs) (io.WriteCloser, error)

HandleOutputFlag returns an io.WriteCloser that represents the output destination.

func RegisterDataFlag

func RegisterDataFlag(cmd *cobra.Command)

RegisterDataFlag registers the data flag with the provided command. The flag allows the user to specify request data.

func RegisterEditFlag

func RegisterEditFlag(cmd *cobra.Command)

RegisterEditFlag registers the edit flag for a given command. The flag allows the user edit input with a text editor of choice.

func RegisterOutputFlag

func RegisterOutputFlag(cmd *cobra.Command)

RegisterOutputFlag registers the output flag for a given command. The flag allows the user to specify an output file to write to.

Types

This section is empty.

Jump to

Keyboard shortcuts

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