shquote

package
v0.71.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: AGPL-3.0 Imports: 1 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 shquote quotes a string for a shell command line. lich composes three of those — the worktree setup wrapper that execs a provider (internal/terminal) and the terminal-editor invocation handed to a session (internal/system), on a POSIX shell; and the same editor invocation on Windows, where the session's shell is PowerShell. All of them interpolate a path or a binary name the user or an agent chose. One copy of each rule, so a metacharacter that survives one call site cannot survive the other.

The window composes a fourth — the `lich send` line a session's card hands out — and carries both rules the same way in frontend/src/lib/session/send-command.ts, the page-side half of this file, tested against the same cases. It picks between them by the platform the window itself runs on: that line is pasted into a terminal on this machine, so the shell that decides is the user's own.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Quote

func Quote(s string) string

Quote returns s single-quoted, safe against embedded single quotes. It assumes an sh/bash/zsh-style shell; PowerShell, which a Windows session runs, spells the escape differently — see QuotePwsh.

func QuotePwsh

func QuotePwsh(s string) string

QuotePwsh returns s single-quoted for PowerShell, safe against embedded single quotes. PowerShell expands nothing inside a single-quoted string — no $variable, no `backtick escape, no subexpression — so doubling the quote is the whole rule, and unlike cmd.exe (which lich no longer opens a session in) there is no character it cannot express.

Types

This section is empty.

Jump to

Keyboard shortcuts

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