cosh

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Overview

Package cosh defines convenient utility functions for use in the cosh shell, available with the cosh prefix.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllFiles added in v0.2.2

func AllFiles(path string) []string

AllFiles returns a list of all files (excluding directories) under the given path.

func FileExists

func FileExists(path string) bool

FileExists returns true if given file exists

func ReadFile

func ReadFile(filename string) string

ReadFile reads the string from the given file, logging any errors.

func ReplaceInFile

func ReplaceInFile(filename, old, new string) string

ReplaceInFile replaces all occurrences of given string with replacement in given file, rewriting the file. Also returns the updated string.

func SplitLines

func SplitLines(s string) []string

SplitLines returns a slice of given string split by lines with any extra whitespace trimmed for each line entry.

func StringsToAnys

func StringsToAnys(s []string) []any

StringsToAnys converts a slice of strings to a slice of any, using slicesx.ToAny. The interpreter cannot process generics yet, so this wrapper is needed. Use for passing args to a command, for example.

func WriteFile

func WriteFile(filename, str string) error

WriteFile writes string to given file with standard permissions, logging any errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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