cli

package
v0.0.0-...-c29240b Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MainClient

func MainClient(fn func(cfg *ClientConfig, m proxy.FileSystemMount) error)

func OnInterrupt

func OnInterrupt(f func())

func ServiceMain

func ServiceMain(createfs func() ninep.FileSystem)

ServiceMain starts a ninep.Server from a constructor of a ninep.FileSystem. The server takes responsibility for calling Close() on ninep.FileSystem on shutdown.

func ServiceMainWithFactory

func ServiceMainWithFactory(createcfg func(stdout, stderr io.Writer) ServerConfig, createfs func() ninep.FileSystem)

func ServiceMainWithLogger

func ServiceMainWithLogger(createfs func(L *slog.Logger) ninep.FileSystem)

ServiceMainWithLogger starts a ninep.Server from a constructor of a ninep.FileSystem. The server takes responsibility for calling Close() on ninep.FileSystem on shutdown. Logger is the configured logger available from cli args

func SupportsColor

func SupportsColor(noColorHint bool)

Types

type ClientConfig

type ClientConfig struct {
	LogLevel           string
	PrintTraceMessages bool
	PrintErrorMessages bool
	UseRecoverClient   bool

	PrintPrefix string

	User string
	Root string

	TimeoutInSeconds int

	Logger *slog.Logger
	// contains filtered or unexported fields
}

ClientConfig provides configuration for an easy cli client

func (*ClientConfig) CreateClient

func (c *ClientConfig) CreateClient(addr string) (ninep.Client, error)

func (*ClientConfig) CreateFs

func (c *ClientConfig) CreateFs(addr string) (ninep.Client, *ninep.FileSystemProxy, error)

func (*ClientConfig) FSMount

func (*ClientConfig) FSMountMany

func (c *ClientConfig) FSMountMany(cfgs []proxy.FileSystemMountConfig) ([]proxy.FileSystemMount, error)

func (*ClientConfig) SetFlags

func (c *ClientConfig) SetFlags(f Flags)

type Flags

type Flags interface {
	StringVar(*string, string, string, string)
	IntVar(*int, string, int, string)
	BoolVar(*bool, string, bool, string)

	ReadFileConfig(filename string) error

	Parse() ([]string, error)
	Usage()
}

type ServerConfig

type ServerConfig struct {
	Addr string

	LogLevel string

	CertFile string
	KeyFile  string

	ReadTimeoutInSeconds          int
	MaxInflightRequestsPerSession int

	Dialer ninep.Dialer // defaults to net

	Stdout io.Writer
	Stderr io.Writer

	PrintHelp bool

	MemProfile string
	CpuProfile string

	PrintPrefix string
	Logger      *slog.Logger
	// contains filtered or unexported fields
}

func (*ServerConfig) Close

func (c *ServerConfig) Close()

func (*ServerConfig) CreateServer

func (c *ServerConfig) CreateServer(createfs func(L *slog.Logger) ninep.FileSystem) *ninep.Server

func (*ServerConfig) CreateServerAndListen

func (c *ServerConfig) CreateServerAndListen(createfs func(L *slog.Logger) ninep.FileSystem) error

func (*ServerConfig) ListenAndServe

func (c *ServerConfig) ListenAndServe(srv *ninep.Server) error

func (*ServerConfig) SetFlags

func (c *ServerConfig) SetFlags(f Flags)

type StdFlags

type StdFlags struct {
	// contains filtered or unexported fields
}

func (*StdFlags) BoolVar

func (f *StdFlags) BoolVar(p *bool, name string, defaultValue bool, help string)

func (*StdFlags) IntVar

func (f *StdFlags) IntVar(p *int, name string, defaultValue int, help string)

func (*StdFlags) Parse

func (f *StdFlags) Parse() ([]string, error)

func (*StdFlags) ReadFileConfig

func (f *StdFlags) ReadFileConfig(filename string) error

func (*StdFlags) StringVar

func (f *StdFlags) StringVar(p *string, name string, defaultValue string, help string)

func (*StdFlags) Usage

func (f *StdFlags) Usage()

Jump to

Keyboard shortcuts

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