shellq

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 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 shellq renders values as shell words.

Commands lectern builds are executed by a real shell on the target, so every interpolated value has to survive as ONE argument no matter what is in it. Quoting only what needs quoting also keeps the generated commands readable in the timeline and in `tmux list-panes`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HomePath added in v2.4.0

func HomePath(rel string) string

HomePath renders "$HOME" followed by rel (which must start with "/") as ONE shell word that the target shell expands at run time.

A naive `Quote("$HOME" + rel)` is a real, reproducible bug: `$` is not in safeWord's charset, so Quote falls back to single-quoting the whole string — which disables `$HOME` expansion entirely, leaving the shell to look for a literal subdirectory named "$HOME" relative to its cwd and fail with "No such file or directory". Confirmed against a real bash: this exact shape (`shellq.Quote("$HOME/...")`, as internal/agentevents' notify/hooks installers built their target path) breaks at the `cat >` that writes the installed script/settings file.

The fix is the standard shell idiom of concatenating a double-quoted (expanding) segment directly against a second quoted-or-bare segment with no whitespace between them — bash joins adjacent word fragments into one argument, so `"$HOME"/.lectern/hooks/x` is one word whose first part expands and whose second part is Quote's ordinary literal rendering.

func Quote

func Quote(s string) string

Quote renders one shell word.

Types

This section is empty.

Jump to

Keyboard shortcuts

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