Documentation
¶
Index ¶
- func AbsolutePath(filename string) string
- func FileExists(filename string) bool
- func FolderExists(filename string) bool
- func FolderIsEmpty(filename string) (bool, error)
- func IsInteractive() bool
- func OpenFile(folder string, pattern string) (*os.File, error)
- func WrapExitError(err error) error
- func WrapExitErrorf(err error, message string, args ...interface{}) error
- type Filenames
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsolutePath ¶
AbsolutePath returns the absolute path to the given file. If the filename is not already an absolute path, then we assume that it is a file path relative to the current working directory
func FileExists ¶
FileExists checks if a file exists and is not a directory
func FolderIsEmpty ¶
FolderIsEmpty checks if a folder is empty
func IsInteractive ¶
func IsInteractive() bool
func OpenFile ¶
OpenFile looks inside of the given folder for a file matching the given pattern. Will return a non-nil error when either no or more than one files match. Returns the opened file otherwise.
func WrapExitError ¶
WrapExitError checks whether `err` is an *exec.ExitError and wraps it in a nice way Includes the Stderr output in the error message.
func WrapExitErrorf ¶
WrapExitErrorf checks whether `err` is an *exec.ExitError and wraps it in a nice way Instead of the stderr output, this function allows you to specify your own message and possible formatting arguments.
Types ¶
type Filenames ¶
type Filenames []string
Filenames is simply an alias for []string, but allows me to add some methods.
func FindFilesByExtInDir ¶
FindFilesByExtInDir finds all files in the given directory and subdirectories that have a certain file extension. File extension must start with a '.', e.g. ".py" or ".ipynb" Returns filepaths relative to the given directory. Ignores hidden folders (folders whose names start with a '.'), but not hidden files. Also explicitly ignores `venv`, `env`. `venv.bak` and `env.bak` folders
func FindIPynbFilesIn ¶
FindIPynbFilesIn finds all Jupyter Notebook (*.ipynb) files in the given directory and subdirectories. Returns their filepaths, relative to the given directory. Ignores hidden folders (folders whose names start with a '.'), but not hidden files.
func FindPythonFilesIn ¶
FindPythonFilesIn finds all Python (*.py) files in the given directory and subdirectories Returns their filepaths, relative to the given directory Ignores hidden folders (folders whose names start with a '.'), but not hidden files.