util

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShorthandHome

func ShorthandHome(path string) string

ShorthandHome returns the same path but replaces the first part of the path with the home shorthand ("~") if the path is inside the home directory.

Example:

Input:  "/home/jane/Downloads"
Output: "~/Downloads"

func Stringify

func Stringify(val any) string

Stringify converts a value to a string. This functions differently than the stdlib fmt.Sprint but having some custom settings for some types:

- Nils are formatted as empty string, instead of "<nil>"

- Floats are always formatted in decimal notation

- Other types still use fmt.Sprint

Types

This section is empty.

Jump to

Keyboard shortcuts

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