Documentation
¶
Overview ¶
Package native contains the built-in native Go plugins shipped with memsh.
Package native contains the built-in native Go plugins shipped with memsh.
Package native contains the built-in native Go plugins shipped with memsh.
Package native contains the built-in native Go plugins shipped with memsh.
Package native contains the built-in native Go plugins shipped with memsh.
Index ¶
- Constants
- func WithPagerMode(ctx context.Context) context.Context
- type AwkPlugin
- type Base64Plugin
- type BcPlugin
- type CatPlugin
- type CdPlugin
- type ChecksumPlugin
- type ChmodPlugin
- type ClearPlugin
- type ColumnPlugin
- type CpPlugin
- type CrontabPlugin
- type CurlPlugin
- type CutPlugin
- type DatePlugin
- type DfPlugin
- type DiffPlugin
- type DotPlugin
- type DuPlugin
- type EchoPlugin
- type EnvPlugin
- type EnvsubstPlugin
- type ExitPlugin
- type ExprPlugin
- type FindPlugin
- type GoPlugin
- type GojaPlugin
- type GrepPlugin
- type GzipPlugin
- type HeadPlugin
- type HelpPlugin
- type HexdumpPlugin
- type JqPlugin
- type LessPlugin
- type LnPlugin
- type LsPlugin
- type LuaPlugin
- type ManPlugin
- type MkdirPlugin
- type MktempPlugin
- type MvPlugin
- type PrintenvPlugin
- type PrintfPlugin
- type PwdPlugin
- type QuitPlugin
- type ReadPlugin
- type ResetPlugin
- type RmPlugin
- type RmdirPlugin
- type SQLitePlugin
- type SSHPlugin
- type SedPlugin
- type SeqPlugin
- type SleepPlugin
- type SortPlugin
- type SourcePlugin
- type StatPlugin
- type SttyPlugin
- type TailPlugin
- type TarPlugin
- type TeePlugin
- type TimeoutPlugin
- type TouchPlugin
- type TputPlugin
- type TrPlugin
- type UniqPlugin
- type WcPlugin
- type WhichPlugin
- type XargsPlugin
- type XxdPlugin
- type YesPlugin
- type YqPlugin
- type ZipPlugin
Constants ¶
const PagerSentinel = "\x00PAGER\x00"
PagerSentinel is written at the very start of `less` stdout when running in pager mode (web terminal / HTTP server). The server strips it and sets pager:true in the JSON response so the browser can render the overlay.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AwkPlugin ¶
type AwkPlugin struct{}
AwkPlugin runs awk programs via the goawk interpreter.
awk '<program>' [file...] awk -f <progfile> [file...]
func (AwkPlugin) Description ¶
type Base64Plugin ¶
type Base64Plugin struct{}
Base64Plugin encodes or decodes base64 data.
base64 [data...] encode positional args (or stdin when none given) base64 -d [data...] decode
func (Base64Plugin) Description ¶
func (Base64Plugin) Description() string
func (Base64Plugin) Name ¶
func (Base64Plugin) Name() string
func (Base64Plugin) Usage ¶
func (Base64Plugin) Usage() string
type ChecksumPlugin ¶
type ChecksumPlugin struct {
// contains filtered or unexported fields
}
ChecksumPlugin computes or verifies file checksums.
sha256sum file... sha256sum -c sums.txt echo "data" | sha256sum
func MD5Sum ¶
func MD5Sum() ChecksumPlugin
func SHA1Sum ¶
func SHA1Sum() ChecksumPlugin
func SHA224Sum ¶
func SHA224Sum() ChecksumPlugin
func SHA256Sum ¶
func SHA256Sum() ChecksumPlugin
func SHA384Sum ¶
func SHA384Sum() ChecksumPlugin
func SHA512Sum ¶
func SHA512Sum() ChecksumPlugin
func (ChecksumPlugin) Description ¶
func (c ChecksumPlugin) Description() string
func (ChecksumPlugin) Name ¶
func (c ChecksumPlugin) Name() string
func (ChecksumPlugin) Usage ¶
func (c ChecksumPlugin) Usage() string
type ChmodPlugin ¶
type ChmodPlugin struct{}
func (ChmodPlugin) Description ¶
func (ChmodPlugin) Description() string
func (ChmodPlugin) Name ¶
func (ChmodPlugin) Name() string
func (ChmodPlugin) Usage ¶
func (ChmodPlugin) Usage() string
type ClearPlugin ¶
type ClearPlugin struct{}
func (ClearPlugin) Description ¶
func (ClearPlugin) Description() string
func (ClearPlugin) Name ¶
func (ClearPlugin) Name() string
func (ClearPlugin) Usage ¶
func (ClearPlugin) Usage() string
type ColumnPlugin ¶
type ColumnPlugin struct{}
ColumnPlugin formats input into aligned columns.
column -t table mode: align whitespace-delimited fields column -t -s ':' use ':' as input separator column -t -o ' | ' use ' | ' as output separator column -t -n don't merge adjacent delimiters (treat empty fields as real) column -c 80 fill-column mode: wrap items into N-wide display column -x fill rows before columns (row-major order) cat /etc/passwd | column -t -s ':'
func (ColumnPlugin) Description ¶
func (ColumnPlugin) Description() string
func (ColumnPlugin) Name ¶
func (ColumnPlugin) Name() string
func (ColumnPlugin) Usage ¶
func (ColumnPlugin) Usage() string
type CrontabPlugin ¶
type CrontabPlugin struct{}
CrontabPlugin implements the `crontab` command against the virtual FS.
crontab -l print /.crontab, or a "no crontab" message if absent crontab -r remove /.crontab silently crontab <file> validate and install <file> as /.crontab crontab read stdin, validate, and install as /.crontab
func (CrontabPlugin) Description ¶
func (CrontabPlugin) Description() string
func (CrontabPlugin) Name ¶
func (CrontabPlugin) Name() string
func (CrontabPlugin) Usage ¶
func (CrontabPlugin) Usage() string
type CurlPlugin ¶
type CurlPlugin struct{}
CurlPlugin performs HTTP requests, mimicking curl behaviour.
curl [options] <url>
curl -X POST -d '{"k":"v"}' -H 'Content-Type: application/json' https://example.com/api
curl -o /out.html https://example.com
curl -L -s https://example.com | jq .
func (CurlPlugin) Description ¶
func (CurlPlugin) Description() string
func (CurlPlugin) Name ¶
func (CurlPlugin) Name() string
func (CurlPlugin) Usage ¶
func (CurlPlugin) Usage() string
type DatePlugin ¶
type DatePlugin struct{}
func (DatePlugin) Description ¶
func (DatePlugin) Description() string
func (DatePlugin) Name ¶
func (DatePlugin) Name() string
func (DatePlugin) Usage ¶
func (DatePlugin) Usage() string
type DiffPlugin ¶
type DiffPlugin struct{}
func (DiffPlugin) Description ¶
func (DiffPlugin) Description() string
func (DiffPlugin) Name ¶
func (DiffPlugin) Name() string
func (DiffPlugin) Usage ¶
func (DiffPlugin) Usage() string
type EchoPlugin ¶
type EchoPlugin struct{}
func (EchoPlugin) Description ¶
func (EchoPlugin) Description() string
func (EchoPlugin) Name ¶
func (EchoPlugin) Name() string
func (EchoPlugin) Usage ¶
func (EchoPlugin) Usage() string
type EnvsubstPlugin ¶
type EnvsubstPlugin struct{}
EnvsubstPlugin substitutes environment variable references in text.
envsubst read stdin, replace all $VAR / ${VAR}
envsubst '$VAR1 $VAR2' only substitute the listed variables
envsubst < template.txt
cat tmpl.txt | envsubst '$HOME $USER'
func (EnvsubstPlugin) Description ¶
func (EnvsubstPlugin) Description() string
func (EnvsubstPlugin) Name ¶
func (EnvsubstPlugin) Name() string
func (EnvsubstPlugin) Usage ¶
func (EnvsubstPlugin) Usage() string
type ExitPlugin ¶
type ExitPlugin struct{}
func (ExitPlugin) Description ¶
func (ExitPlugin) Description() string
func (ExitPlugin) Name ¶
func (ExitPlugin) Name() string
func (ExitPlugin) Usage ¶
func (ExitPlugin) Usage() string
type ExprPlugin ¶
type ExprPlugin struct{}
func (ExprPlugin) Description ¶
func (ExprPlugin) Description() string
func (ExprPlugin) Name ¶
func (ExprPlugin) Name() string
func (ExprPlugin) Usage ¶
func (ExprPlugin) Usage() string
type FindPlugin ¶
type FindPlugin struct{}
FindPlugin searches the virtual filesystem for files matching criteria.
find [path] [-name <glob>] [-type f|d]
func (FindPlugin) Description ¶
func (FindPlugin) Description() string
func (FindPlugin) Name ¶
func (FindPlugin) Name() string
func (FindPlugin) Usage ¶
func (FindPlugin) Usage() string
type GoPlugin ¶ added in v0.0.14
type GoPlugin struct{}
GoPlugin emulates the Go toolchain for source files stored in the virtual filesystem, backed by the MVM interpreter.
go run <file.go> run a Go source file go test [./path|./...] [-v] [-run RE] run Test* functions go fmt <file.go> [...] format Go source in place go version print MVM version
func (GoPlugin) Description ¶ added in v0.0.14
type GojaPlugin ¶
type GojaPlugin struct{}
GojaPlugin executes JavaScript code using goja.
goja [-e 'code'] execute inline JavaScript code
goja [file.js] execute JavaScript file from virtual filesystem
(reads JavaScript code from stdin when no args)
func (GojaPlugin) Description ¶
func (GojaPlugin) Description() string
func (GojaPlugin) Name ¶
func (GojaPlugin) Name() string
func (GojaPlugin) Usage ¶
func (GojaPlugin) Usage() string
type GrepPlugin ¶
type GrepPlugin struct{}
GrepPlugin searches file contents for lines matching a pattern.
grep [-i] [-n] [-v] [-r] <pattern> [file...] read from files or stdin
func (GrepPlugin) Description ¶
func (GrepPlugin) Description() string
func (GrepPlugin) Name ¶
func (GrepPlugin) Name() string
func (GrepPlugin) Usage ¶
func (GrepPlugin) Usage() string
type GzipPlugin ¶
type GzipPlugin struct {
// contains filtered or unexported fields
}
GzipPlugin compresses or decompresses files using gzip.
gzip file compress → file.gz, remove original gzip -d file.gz decompress → file, remove .gz gzip -k file keep original gzip -c file write to stdout gzip -l file.gz list compressed file info gunzip file.gz decompress (alias for gzip -d)
func (GzipPlugin) Description ¶
func (g GzipPlugin) Description() string
func (GzipPlugin) Name ¶
func (g GzipPlugin) Name() string
func (GzipPlugin) Usage ¶
func (GzipPlugin) Usage() string
type HeadPlugin ¶
type HeadPlugin struct{}
func (HeadPlugin) Description ¶
func (HeadPlugin) Description() string
func (HeadPlugin) Name ¶
func (HeadPlugin) Name() string
func (HeadPlugin) Usage ¶
func (HeadPlugin) Usage() string
type HelpPlugin ¶
type HelpPlugin struct{}
func (HelpPlugin) Description ¶
func (HelpPlugin) Description() string
func (HelpPlugin) Name ¶
func (HelpPlugin) Name() string
func (HelpPlugin) Usage ¶
func (HelpPlugin) Usage() string
type HexdumpPlugin ¶
type HexdumpPlugin struct{}
func (HexdumpPlugin) Description ¶
func (HexdumpPlugin) Description() string
func (HexdumpPlugin) Name ¶
func (HexdumpPlugin) Name() string
func (HexdumpPlugin) Usage ¶
func (HexdumpPlugin) Usage() string
type JqPlugin ¶
type JqPlugin struct{}
JqPlugin processes JSON using the gojq library.
jq [options] <expr> [file...]
jq .field data.json
echo '{"a":1}' | jq .a
func (JqPlugin) Description ¶
type LessPlugin ¶
type LessPlugin struct {
// contains filtered or unexported fields
}
LessPlugin implements the `less` pager. It reads file arguments (or stdin) and writes PagerSentinel + the full content to stdout so the web terminal can render a scrollable pager overlay.
Most flags that control display behaviour (line numbers, wrapping, colour) are client-side concerns and are silently accepted but ignored here. Flags that affect content selection (+N start line, -N/-n line numbers) are passed through in the sentinel metadata line so the client can act on them.
Sentinel format:
\x00PAGER\x00<JSON metadata>\n<file content>
Metadata JSON fields:
start int – 0-based line to start at (from +N argument, default 0) numbers bool – whether to show line numbers (-N flag, default true; -n disables)
func (LessPlugin) Description ¶
func (p LessPlugin) Description() string
func (LessPlugin) Name ¶
func (p LessPlugin) Name() string
func (LessPlugin) Usage ¶
func (p LessPlugin) Usage() string
type LuaPlugin ¶
type LuaPlugin struct{}
LuaPlugin executes Lua code using gopher-lua.
lua [-e 'code'] execute inline Lua code
lua [file.lua] execute Lua file from virtual filesystem
(reads Lua code from stdin when no args)
func (LuaPlugin) Description ¶
type MkdirPlugin ¶
type MkdirPlugin struct{}
func (MkdirPlugin) Description ¶
func (MkdirPlugin) Description() string
func (MkdirPlugin) Name ¶
func (MkdirPlugin) Name() string
func (MkdirPlugin) Usage ¶
func (MkdirPlugin) Usage() string
type MktempPlugin ¶
type MktempPlugin struct{}
MktempPlugin creates a temporary file or directory in the virtual FS.
mktemp /tmp/tmp.XXXXXXXXXX mktemp -d /tmp/tmp.XXXXXXXXXX (directory) mktemp -p /var/tmp use alternate base dir mktemp --suffix .json append suffix after substituted Xs mktemp /tmp/myapp.XXXXXX custom template mktemp -u TEMPLATE dry-run: print name without creating
func (MktempPlugin) Description ¶
func (MktempPlugin) Description() string
func (MktempPlugin) Name ¶
func (MktempPlugin) Name() string
func (MktempPlugin) Usage ¶
func (MktempPlugin) Usage() string
type PrintenvPlugin ¶
type PrintenvPlugin struct{}
func (PrintenvPlugin) Description ¶
func (PrintenvPlugin) Description() string
func (PrintenvPlugin) Name ¶
func (PrintenvPlugin) Name() string
func (PrintenvPlugin) Usage ¶
func (PrintenvPlugin) Usage() string
type PrintfPlugin ¶
type PrintfPlugin struct{}
func (PrintfPlugin) Description ¶
func (PrintfPlugin) Description() string
func (PrintfPlugin) Name ¶
func (PrintfPlugin) Name() string
func (PrintfPlugin) Usage ¶
func (PrintfPlugin) Usage() string
type QuitPlugin ¶
type QuitPlugin struct{}
func (QuitPlugin) Description ¶
func (QuitPlugin) Description() string
func (QuitPlugin) Name ¶
func (QuitPlugin) Name() string
func (QuitPlugin) Usage ¶
func (QuitPlugin) Usage() string
type ReadPlugin ¶
type ReadPlugin struct{}
func (ReadPlugin) Description ¶
func (ReadPlugin) Description() string
func (ReadPlugin) Name ¶
func (ReadPlugin) Name() string
func (ReadPlugin) Usage ¶
func (ReadPlugin) Usage() string
type ResetPlugin ¶
type ResetPlugin struct{}
func (ResetPlugin) Description ¶
func (ResetPlugin) Description() string
func (ResetPlugin) Name ¶
func (ResetPlugin) Name() string
func (ResetPlugin) Usage ¶
func (ResetPlugin) Usage() string
type RmdirPlugin ¶
type RmdirPlugin struct{}
func (RmdirPlugin) Description ¶
func (RmdirPlugin) Description() string
func (RmdirPlugin) Name ¶
func (RmdirPlugin) Name() string
func (RmdirPlugin) Usage ¶
func (RmdirPlugin) Usage() string
type SQLitePlugin ¶
type SQLitePlugin struct{}
SQLitePlugin implements an sqlite3-like CLI against the virtual filesystem.
sqlite3 [flags] [DBFILE] [SQL...]
DBFILE defaults to ":memory:". When a path is given the database bytes are copied from afero to a temp OS file, operated on, then written back.
func (SQLitePlugin) Description ¶
func (SQLitePlugin) Description() string
func (SQLitePlugin) Name ¶
func (SQLitePlugin) Name() string
func (SQLitePlugin) Usage ¶
func (SQLitePlugin) Usage() string
type SSHPlugin ¶
type SSHPlugin struct{}
SSHPlugin connects to a remote memsh SSH server (started with memsh serve --ssh).
Usage:
ssh [-p password] [-P port] [user@]host[:port] [-- command args...]
Without "--": opens an interactive remote REPL (reads from hc.Stdin). With "--": runs a single command on the remote and returns its output.
The SSH username is used as the remote session ID, so reconnecting with the same username resumes the same virtual filesystem. Use a random username for an isolated session (the server auto-generates one if you use "memsh").
func (SSHPlugin) Description ¶
type SleepPlugin ¶
type SleepPlugin struct{}
func (SleepPlugin) Description ¶
func (SleepPlugin) Description() string
func (SleepPlugin) Name ¶
func (SleepPlugin) Name() string
func (SleepPlugin) Usage ¶
func (SleepPlugin) Usage() string
type SortPlugin ¶
type SortPlugin struct{}
func (SortPlugin) Description ¶
func (SortPlugin) Description() string
func (SortPlugin) Name ¶
func (SortPlugin) Name() string
func (SortPlugin) Usage ¶
func (SortPlugin) Usage() string
type SourcePlugin ¶
type SourcePlugin struct{}
func (SourcePlugin) Description ¶
func (SourcePlugin) Description() string
func (SourcePlugin) Name ¶
func (SourcePlugin) Name() string
func (SourcePlugin) Usage ¶
func (SourcePlugin) Usage() string
type StatPlugin ¶
type StatPlugin struct{}
func (StatPlugin) Description ¶
func (StatPlugin) Description() string
func (StatPlugin) Name ¶
func (StatPlugin) Name() string
func (StatPlugin) Usage ¶
func (StatPlugin) Usage() string
type SttyPlugin ¶
type SttyPlugin struct{}
func (SttyPlugin) Description ¶
func (SttyPlugin) Description() string
func (SttyPlugin) Name ¶
func (SttyPlugin) Name() string
func (SttyPlugin) Usage ¶
func (SttyPlugin) Usage() string
type TailPlugin ¶
type TailPlugin struct{}
func (TailPlugin) Description ¶
func (TailPlugin) Description() string
func (TailPlugin) Name ¶
func (TailPlugin) Name() string
func (TailPlugin) Usage ¶
func (TailPlugin) Usage() string
type TarPlugin ¶
type TarPlugin struct{}
TarPlugin creates and extracts tar archives (optionally gzip/bzip2 compressed).
tar -czf archive.tar.gz file1 file2 dir/ tar -xf archive.tar.gz tar -xf archive.tar.gz -C /dest tar -tf archive.tar.gz
func (TarPlugin) Description ¶
type TimeoutPlugin ¶
type TimeoutPlugin struct{}
func (TimeoutPlugin) Description ¶
func (TimeoutPlugin) Description() string
func (TimeoutPlugin) Name ¶
func (TimeoutPlugin) Name() string
func (TimeoutPlugin) Usage ¶
func (TimeoutPlugin) Usage() string
type TouchPlugin ¶
type TouchPlugin struct{}
func (TouchPlugin) Description ¶
func (TouchPlugin) Description() string
func (TouchPlugin) Name ¶
func (TouchPlugin) Name() string
func (TouchPlugin) Usage ¶
func (TouchPlugin) Usage() string
type TputPlugin ¶
type TputPlugin struct{}
func (TputPlugin) Description ¶
func (TputPlugin) Description() string
func (TputPlugin) Name ¶
func (TputPlugin) Name() string
func (TputPlugin) Usage ¶
func (TputPlugin) Usage() string
type UniqPlugin ¶
type UniqPlugin struct{}
func (UniqPlugin) Description ¶
func (UniqPlugin) Description() string
func (UniqPlugin) Name ¶
func (UniqPlugin) Name() string
func (UniqPlugin) Usage ¶
func (UniqPlugin) Usage() string
type WcPlugin ¶
type WcPlugin struct{}
WcPlugin counts lines, words, and bytes.
wc [-l] [-w] [-c] [file] read from virtual-FS file or stdin
func (WcPlugin) Description ¶
type WhichPlugin ¶
type WhichPlugin struct{}
func (WhichPlugin) Description ¶
func (WhichPlugin) Description() string
func (WhichPlugin) Name ¶
func (WhichPlugin) Name() string
func (WhichPlugin) Usage ¶
func (WhichPlugin) Usage() string
type XargsPlugin ¶
type XargsPlugin struct{}
func (XargsPlugin) Description ¶
func (XargsPlugin) Description() string
func (XargsPlugin) Name ¶
func (XargsPlugin) Name() string
func (XargsPlugin) Usage ¶
func (XargsPlugin) Usage() string
type YqPlugin ¶
type YqPlugin struct{}
YqPlugin processes YAML (and JSON) using gojq. Input is parsed as YAML (a superset of JSON), the jq expression is applied, and results are written back as YAML by default or JSON with -j.
yq [options] <expr> [file...] yq .name data.yaml echo 'name: alice' | yq .name
func (YqPlugin) Description ¶
type ZipPlugin ¶
type ZipPlugin struct {
// contains filtered or unexported fields
}
ZipPlugin creates or updates zip archives on the virtual FS.
zip archive.zip file1 file2 zip -r archive.zip dir/ zip -l archive.zip (list, alias for unzip -l)
func (ZipPlugin) Description ¶
Source Files
¶
- awk.go
- base64.go
- bc.go
- calc.go
- cat.go
- cd.go
- checksum.go
- chmod.go
- clear.go
- column.go
- cp.go
- crontab.go
- curl.go
- cut.go
- date.go
- df.go
- diff.go
- dot.go
- du.go
- echo.go
- env.go
- envsubst.go
- exit.go
- expr.go
- find.go
- go.go
- go_stdlib_notwindows.go
- goja.go
- grep.go
- gzip.go
- head.go
- help.go
- helpers.go
- hexdump.go
- jq.go
- less.go
- ln.go
- ls.go
- lua.go
- man.go
- mkdir.go
- mktemp.go
- mv.go
- printenv.go
- printf.go
- pwd.go
- quit.go
- read.go
- reset.go
- rm.go
- rmdir.go
- sed.go
- seq.go
- shell_state.go
- sleep.go
- sort.go
- source.go
- sqlite.go
- ssh.go
- stat.go
- stty.go
- tail.go
- tar.go
- tee.go
- timeout.go
- touch.go
- tput.go
- tr.go
- uniq.go
- wc.go
- which.go
- xargs.go
- xxd.go
- yes.go
- yq.go
- zip.go