commands

package
v0.0.0-...-c0b29db Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BoolOptions = ignoreCaseSorted.MapToDictionary(map[string]*optionT{
	"completion_hidden": {
		V:       &completion.IncludeHidden,
		Usage:   "Include hidden files on completion",
		NoUsage: "Do not include hidden files on completion",
	},
	"completion_slash": {
		V:       &completion.UseSlash,
		Usage:   "use forward slash on completion",
		NoUsage: "Do not use slash on completion",
	},
	"glob": {
		V:       &shell.WildCardExpansionAlways,
		Usage:   "Enable to expand wildcards",
		NoUsage: "Disable to expand wildcards",
	},
	"glob_slash": {
		V:       &shell.GlobUseSlash,
		Usage:   "Use forward slash on wildcard expansion",
		NoUsage: "Do not Use forward slash on wildcard expansion",
	},
	"noclobber": {
		V:       &shell.NoClobber,
		Usage:   "forbide to overwrite files on redirect",
		NoUsage: "Do not forbide to overwrite files no redirect",
	},
	"usesource": {
		V:       &shell.UseSourceRunBatch,
		Usage:   "allow batchfile to change environment variables of nyagos",
		NoUsage: "forbide batchfile to change environment variables of nyagos",
	},
	"tilde_expansion": {
		V:       &shell.TildeExpansion,
		Usage:   "Enable Tilde Expansion",
		NoUsage: "Disable Tilde Expansion",
	},
	"read_stdin_as_file": {
		V:       &ReadStdinAsFile,
		Usage:   "Read commands from stdin as a file stream. Disable to edit line",
		NoUsage: "Read commands from stdin as Windows Console(tty). Enable to edit line",
	},
	"output_surrogate_pair": {
		Setter:  readline.EnableSurrogatePair,
		Getter:  readline.IsSurrogatePairEnabled,
		Usage:   "Output surrogate pair characters as it is",
		NoUsage: "Output surrogate pair characters like <NNNNN>",
	},
})

BoolOptions are the all global option list.

View Source
var ReadStdinAsFile = false

ReadStdinAsFile is the flat to read commands from stdin as a file stream

Functions

func AllNames

func AllNames(ctx context.Context) ([]completion.Element, error)

AllNames returns all command-names for completion package.

func CorrectCase

func CorrectCase(path string) (string, error)

CorrectCase corrects `path`'s case.

func Exec

func Exec(ctx context.Context, cmd Param) (int, bool, error)

Exec is the entry function to call built-in functions from Shell

func StampIsValid

func StampIsValid(year, month, mday, hour, min, sec int) bool

stampIsOk returns true if year,month,mday,hour,min,sec isnot invalid.

Types

type Param

type Param interface {
	Arg(int) string
	Args() []string
	SetArgs(s []string)
	In() io.Reader
	Out() io.Writer
	Err() io.Writer
	Term() io.Writer
	RawArgs() []string
	Spawnlp(context.Context, []string, []string) (int, error)
	Spawnlpe(context.Context, []string, []string, map[string]string) (int, error)
	Loop(context.Context, shell.Stream) (int, error)
	ReadCommand(context.Context) (context.Context, string, error)
	DumpEnv() []string
	Setenv(key, val string)
	GetHistory() shell.History
}

Param is the interface for built-in command

Jump to

Keyboard shortcuts

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