shell

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 8 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.

Documentation

Overview

Package shell performs static syntax checking of egg installation scripts by delegating to the interpreter the egg declares as its entrypoint.

The panel runs the install script inside a container with a specific shell, so the only faithful check is the real interpreter's own parser (`sh -n`). Where that exact interpreter is unavailable a stand-in is used and the result is marked approximate — callers are expected to surface that, because a check that silently did not run is worse than no check at all.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownEntrypoint = errors.New("unknown install entrypoint")

ErrUnknownEntrypoint is returned for entrypoints egglint does not model.

View Source
var KnownEntrypoints = []string{"bash", "ash", "sh", "dash", "zsh"}

KnownEntrypoints lists the entrypoints the panel realistically uses.

Functions

func IsKnownEntrypoint

func IsKnownEntrypoint(ep string) bool

IsKnownEntrypoint reports whether the entrypoint is one egglint understands.

func NormalizeEntrypoint

func NormalizeEntrypoint(ep string) string

NormalizeEntrypoint reduces an entrypoint to its interpreter name. Eggs legitimately declare an absolute path such as "/bin/bash", which names exactly the same shell as "bash".

Types

type Checker

type Checker struct {
	// Entrypoint is the entrypoint declared by the egg, e.g. "bash" or "ash".
	Entrypoint string
	// Argv is the command used to perform the check, empty when unavailable.
	Argv []string
	// Approximate is true when Argv is a stand-in for the declared interpreter
	// (for example dash standing in for busybox ash).
	Approximate bool
	// Note explains an approximate or unavailable checker.
	Note string
}

Checker syntax-checks scripts for one entrypoint.

func For

func For(declared string) (*Checker, error)

For builds a Checker for the declared entrypoint, resolving the best available interpreter on this machine.

func (*Checker) Available

func (c *Checker) Available() bool

Available reports whether a syntax check can actually be performed.

func (*Checker) Check

func (c *Checker) Check(script string) (*Problem, error)

Check runs the syntax check. It returns nil when the script parses cleanly.

Carriage returns are always normalised away first, because that is what the panel itself does: the endpoint wings fetches the install script from applies str_replace(["\r\n", "\n", "\r"], "\n", ...) before returning it, so the interpreter in the install container never sees a CRLF script.

This matters more than it sounds. CRLF genuinely breaks bash, dash and busybox ash — a trailing carriage return stops `then` being the `then` keyword — so checking the raw script would report a syntax error for the large majority of published eggs, none of which fail in practice. CRLF is still worth knowing about, and is reported separately by its own rule at an honest severity.

type Problem

type Problem struct {
	// Line is the 1-based line within the install script, 0 when unknown.
	Line int
	// Message is the interpreter's own diagnostic, with temp paths stripped.
	Message string
}

Problem is a syntax error located within the script.

Jump to

Keyboard shortcuts

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