safety

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package safety holds the checks every action passes before it touches anything. They are fixed in code, not settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inside

func Inside(path string, roots ...string) error

Inside returns an error unless path resolves inside one of the roots. Symlinks are resolved, so a link cannot lead an action out of the folder.

func ShellJoin

func ShellJoin(argv []string) string

ShellJoin quotes every word and joins them with spaces.

func ShellQuote

func ShellQuote(s string) string

ShellQuote quotes one word for a POSIX shell (sh, bash, zsh) with single quotes, so spaces and $ in paths like "My Projects" stay literal. Not for fish: it reads \\ inside single quotes as one backslash.

func SplitWords

func SplitWords(s string) ([]string, error)

SplitWords splits a command typed by the user into words, honouring single and double quotes and backslash escapes. It never expands anything.

Types

This section is empty.

Jump to

Keyboard shortcuts

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