Documentation
¶
Overview ¶
Package cli organizes and implements a command line program.
Index ¶
- func Run(args []string) int
- type App
- func (app *App) CloseTrap()
- func (app *App) NewLogger(w io.Writer) *slog.Logger
- func (app *App) NewServer(logger *slog.Logger) *http.Server
- func (app *App) NoOp() bool
- func (app *App) ParseFlags(args []string)
- func (app *App) StartAndShutdown(server *http.Server, logger *slog.Logger)
- func (app *App) TrapSignals(signals ...os.Signal)
- type WrappedDir
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct {
Trap chan os.Signal
Port string
Dir string
ExitValue int
HelpWanted bool
VersionWanted bool
}
App stores information about the application's state.
func (*App) ParseFlags ¶
ParseFlags handles flags and options in my finicky way.
func (*App) StartAndShutdown ¶
StartAndShutdown starts and (gracefully) shuts down an http.Server.
func (*App) TrapSignals ¶
TrapSignals sets app.Trap to watch for a variable number of signals.
type WrappedDir ¶
type WrappedDir struct {
// contains filtered or unexported fields
}
WrappedDir wraps http.Dir so that we can modify http.Dir's Open method.
Click to show internal directories.
Click to hide internal directories.