package prog

import "src.elv.sh/pkg/prog"

Package prog provides the entry point to Elvish. Its subpackages correspond to subprograms of Elvish.

Index

Package Files

prog.go

Variables

var DeprecationLevel = 15

DeprecationLevel is a global flag that controls which deprecations to show. If its value is X, Elvish shows deprecations that should be shown for version 0.X.

func BadUsage

func BadUsage(msg string) error

BadUsage returns an error that may be returned by Program.Main, which requests the main program to print out a message, the usage information and exit with 2.

func Exit

func Exit(exit int) error

Exit returns an error that may be returned by Program.Main, which requests the main program to exit with the given code. If the exit code is 0, it returns nil.

func Run

func Run(fds [3]*os.File, args []string, programs ...Program) int

Run parses command-line flags and runs the first applicable subprogram. It returns the exit status of the program.

type Flags

type Flags struct {
    Log, CPUProfile string

    Help, Version, BuildInfo, JSON bool

    CodeInArg, CompileOnly, NoRc bool
    RC                           string

    Web  bool
    Port int

    Daemon bool
    Forked int

    DB, Sock string
}

Flags keeps command-line flags.

type Program

type Program interface {
    // ShouldRun returns whether the subprogram should run.
    ShouldRun(f *Flags) bool
    // Run runs the subprogram.
    Run(fds [3]*os.File, f *Flags, args []string) error
}

Program represents a subprogram.

Directories

PathSynopsis
pkg/prog/progtestPackage progtest provides utilities for testing subprograms.

Package prog imports 7 packages (graph).

Version v0.16.3 (latest) | Published Aug 28, 2021 | Platform: linux/amd64 | Updated 14 hours ago

.
Tools for package owners.