util

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package util provides misc utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbbrPath

func AbbrPath(name string) string

AbbrPath abbreviates path beginning of home directory to ~.

func CalcSizeCount

func CalcSizeCount(src ...string) (int64, int)

CalcSizeCount calculates files total size and count, excluding themself of directories and links.

func ExpandPath

func ExpandPath(name string) string

ExpandPath expands path beginning of ~ to the home directory. Not use for file operations because unexpected behavior when exist a file beginning of ~

func FormatSize

func FormatSize(n int64) string

FormatSize returns formated to SI prefix unit.

func Quote

func Quote(s string) string

Quote encloses string double quotes and escapes by backslash if this string contains double quotes.

func RemoveExt

func RemoveExt(name string) string

RemoveExt removes extension from the name.

func SearchCommands

func SearchCommands() (map[string]bool, error)

SearchCommands returns map with key is command name in $PATH.

func ShortenPath

func ShortenPath(path string, width int) string

ShortenPath returns a shorten path to be shorter than width.

func SplitWithSep

func SplitWithSep(s, sep string) []string

SplitWithSep splits string with separator.

Types

This section is empty.

Jump to

Keyboard shortcuts

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