shellquote

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 3 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package shellquote quotes strings and argument lists for a POSIX shell, and splits a quoted command line back into argv without running one. Quote/Join always quote; QuoteMinimal/JoinMinimal leave shell-safe words bare, for text a person reads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Join

func Join(args []string) string

Join quotes each argument and joins them with spaces into one command line, so the shell that parses it splits the words back exactly where they started.

func JoinMinimal

func JoinMinimal(args []string) string

JoinMinimal is Join using QuoteMinimal.

func Quote

func Quote(s string) string

Quote wraps s in single quotes so nothing is expanded or split; embedded single quotes are closed, escaped and reopened. An empty s still quotes to a pair of quotes.

func QuoteMinimal

func QuoteMinimal(s string) string

QuoteMinimal is Quote, but returns a word of shell-literal characters unchanged.

func Split

func Split(raw string) ([]string, error)

Split parses shell-style quoting as used in $EDITOR (`code --wait`, `"/a b/ed" -f`) without a shell. Backslashes escape only whitespace, quotes and backslashes, so quoted Windows paths stay intact.

Types

This section is empty.

Jump to

Keyboard shortcuts

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