io

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 9 Imported by: 3

Documentation

Overview

Package io contains input/output and filesystem-related functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendString

func AppendString(text, path string) error

Append string to given file path

func BaseFileName

func BaseFileName(path string) string

Gets the filename without extension

func ClearScreen

func ClearScreen()

Clear screen

func CountNonEmptyLines

func CountNonEmptyLines(path string) (int, error)

Count non-empty lines of given text file path

func EnsurePathExists

func EnsurePathExists(path string) error

Creates all non-existent folders in given path

func GetCommandOptions

func GetCommandOptions(defaultCommand string) (string, map[string]string)

Get command and options

func IsDir

func IsDir(path string) bool

Check if path is a directory

func OpenFile

func OpenFile(path string) error

Opens file using default viewer

func PathExists

func PathExists(path string) bool

Check if path exists

func ReadCSV

func ReadCSV(path string) ([][]string, error)

Read rows of given CSV file path

func ReadFile

func ReadFile(path string) (string, error)

Read string contents of given text file path

func ReadJSON

func ReadJSON[T any](path string) (*T, error)

Read JSON object from given file path

func ReadJSONList

func ReadJSONList[T any](path string) ([]T, error)

Read JSON list from given file path

func ReadJSONMap

func ReadJSONMap[T any](path string) (map[string]T, error)

Read JSON map from given file path

func ReadLines

func ReadLines(path string) ([]string, error)

Read lines of given text file path, Each line is trimmed for whitespace at both ends

func ReadNonEmptyLines

func ReadNonEmptyLines(path string) ([]string, error)

Read non-empty lines of given text file path, Each non-empty line is trimmed for whitespace at both ends

func ReadRawLines

func ReadRawLines(path string) ([]string, error)

Read lines of given text file path, Lines are not whitespace trimmed

func RunCommand

func RunCommand(args ...string) error

Run command line command

func RunGoInstall

func RunGoInstall(path string) error

Run go install <path>

func SaveIndentedJSON

func SaveIndentedJSON[T any](item T, path string) error

Save indented JSON object to given file path

func SaveJSON

func SaveJSON[T any](item T, path string) error

Save JSON object to given file path

func SaveString

func SaveString(text, path string) error

Save string to given file path

func SoftClearScreen

func SoftClearScreen()

Soft Clear Screen

Types

This section is empty.

Jump to

Keyboard shortcuts

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