Documentation
¶
Index ¶
- Constants
- func ReadLinesFromFile(filePath string, opts ...ReaderOption) ([]string, cenclierrors.CencliError)
- func ReadLinesFromStdin(r io.Reader, opts ...ReaderOption) ([]string, cenclierrors.CencliError)
- func SplitString(line string, opts ...SplitStringOption) []string
- type InvalidInputFileError
- type ReaderOption
- type SplitStringOption
Constants ¶
View Source
const (
StdInSentinel = "-"
)
Variables ¶
This section is empty.
Functions ¶
func ReadLinesFromFile ¶
func ReadLinesFromFile(filePath string, opts ...ReaderOption) ([]string, cenclierrors.CencliError)
ReadLinesFromFile reads lines from a file using the command's input reader.
func ReadLinesFromStdin ¶
func ReadLinesFromStdin(r io.Reader, opts ...ReaderOption) ([]string, cenclierrors.CencliError)
ReadLinesFromStdin reads lines from stdin using the command's input reader.
func SplitString ¶
func SplitString(line string, opts ...SplitStringOption) []string
SplitString splits a string into a list of strings using the given delimiter. If the delimiter is not provided, it defaults to ",". Will always trim whitespace from the parts.
Types ¶
type InvalidInputFileError ¶
type InvalidInputFileError interface {
cenclierrors.CencliError
}
type ReaderOption ¶
type ReaderOption func(*inputReader)
func WithDontTrimSpace ¶
func WithDontTrimSpace() ReaderOption
WithDontTrimSpace sets the input reader to not trim whitespace.
func WithLeaveBlanks ¶
func WithLeaveBlanks() ReaderOption
WithLeaveBlanks sets the input reader to leave blanks.
type SplitStringOption ¶
type SplitStringOption func(*splitStringOptions)
func WithDelimiter ¶
func WithDelimiter(delimiter string) SplitStringOption
WithDelimiter sets the split string option to use the given delimiter.
Click to show internal directories.
Click to hide internal directories.