format

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package format provides functions to format shell scripts and file paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash added in v0.0.3

func Hash(included map[string]string) (string, error)

Hash deterministically combines each file's contents and its exported variables into a single SHA-256 digest.

func Map

func Map[T any](data map[string]T, format string) string

Map takes a map and a format string (like "export %s=%q") and returns a sorted, joined string.

func PosixPath added in v0.0.9

func PosixPath(path string) string

PosixPath converts a Windows path (like `C:/...`) to Posix format (`/c/...`). Converts regardless of platform if a drive letter is detected.

func Shell

func Shell(src string, singleLine bool) (string, error)

Shell formats a shell script source code.

func WindowsPath added in v0.0.9

func WindowsPath(path string) string

WindowsPath converts a Posix path (like `/c/...`) to Windows format (`C:/...`). Converts regardless of platform if a drive letter is detected.

Types

This section is empty.

Jump to

Keyboard shortcuts

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