shellescape

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: BSD-3-Clause Imports: 2 Imported by: ? 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.

README

shellescape GoDoc

Usage

local shellescape = require("shellescape")

escaped = shellescape.quote("foo bar baz")
-- 'foo bar baz'

escaped_command = shellescape.quote_command({ "echo", "foo bar baz" })
-- echo 'foo bar baz'

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Loader

func Loader(L *lua.LState) int

Loader is the module loader function.

func Preload

func Preload(L *lua.LState)

Preload adds json to the given Lua state's package.preload table. After it has been preloaded, it can be loaded using require:

local json = require("json")

func Quote

func Quote(L *lua.LState) int
Example
L := lua.NewState()
Preload(L)
source := `
local shellescape = require("shellescape")
print(shellescape.quote("foo"))
`
if err := L.DoString(source); err != nil {
	log.Fatal(err)
}
Output:
foo

func QuoteCommand

func QuoteCommand(L *lua.LState) int
Example
L := lua.NewState()
Preload(L)
source := `
local shellescape = require("shellescape")
print(shellescape.quote_command({"echo", "foo bar baz"}))
`
if err := L.DoString(source); err != nil {
	log.Fatal(err)
}
Output:
echo 'foo bar baz'

func StripUnsafe

func StripUnsafe(L *lua.LState) int
Example
L := lua.NewState()
Preload(L)
source := `
local shellescape = require("shellescape")
print(shellescape.strip_unsafe("foo\nbar"))
`
if err := L.DoString(source); err != nil {
	log.Fatal(err)
}
Output:
foobar

Types

This section is empty.

Jump to

Keyboard shortcuts

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