Documentation
¶
Overview ¶
Package cli implements the `falak` command-line client for the control-plane public API.
Index ¶
Constants ¶
const ( ExitOK = 0 ExitError = 1 ExitUsage = 2 ExitDeployFailed = 3 )
Exit codes.
const ( ExitInvalid = 5 // the file is invalid ExitApproval = 6 // the run waits for an approval )
Exit codes of the config commands (docs/plans/CONFIG_AS_CODE.md, "CLI").
const ExitConflict = 4
ExitConflict: `falak fn deploy` found a newer version than its base (pull, or deploy with --force).
const ExitDrift = 7
ExitDrift: `falak drift` found the environment drifted from its last applied file.
const ExitTimeout = 124
ExitTimeout: `falak sandbox exec` hit its --timeout (as timeout(1)).
Variables ¶
This section is empty.
Functions ¶
func ConfigDir ¶
ConfigDir resolves the CLI config dir: $FALAK_CONFIG_DIR, else os.UserConfigDir()/falak (~/Library/Application Support/falak on macOS, $XDG_CONFIG_HOME/falak or ~/.config/falak on Linux).
func DeleteCredentials ¶
DeleteCredentials removes stored credentials (no error when absent).
func SaveCredentials ¶
func SaveCredentials(dir string, c Credentials) error
SaveCredentials writes atomically with 0600 (dir 0700).
Types ¶
type App ¶
type App struct {
Stdout io.Writer
Stderr io.Writer
Stdin io.Reader
Getenv func(string) string
// NewAPI builds the API client (tests may return a fake).
NewAPI func(baseURL, token string) api.API
// Exec replaces the process (ssh). Open opens a URL in a browser.
Exec func(argv []string) error
Open func(url string) error
// Poll is the interval for --wait / --follow polling.
Poll time.Duration
Version string
// Interactive reports whether Stdin is a terminal (login prompt).
Interactive bool
// ReadSecret reads a line without echo (interactive login); nil falls back to Stdin.
ReadSecret func() (string, error)
// Executable is the binary `falak update` replaces; nil means os.Executable.
Executable func() (string, error)
// Dir is the working directory ("" = the process's).
Dir string
// GitBranch returns the current branch of the repository holding dir (nil: runs git).
GitBranch func(dir string) string
// Terminal is the local terminal for `falak console` (nil: stdin isn't a terminal).
Terminal Terminal
// contains filtered or unexported fields
}
App holds I/O and injectable dependencies; one App serves one invocation.
type Credentials ¶
type Credentials struct {
URL string `json:"url"`
Token string `json:"token"`
User string `json:"user,omitempty"`
Organization string `json:"organization,omitempty"`
}
Credentials are stored in <config dir>/falak/credentials.json with mode 0600.
func LoadCredentials ¶
func LoadCredentials(dir string) (Credentials, error)
LoadCredentials returns zero Credentials when none are stored.
type Terminal ¶
type Terminal interface {
// MakeRaw puts the terminal into raw mode (Ctrl-C and friends go to the remote shell) and returns its undo.
MakeRaw() (restore func(), err error)
Size() (cols, rows int, err error)
// Resized signals every window size change until stop is called.
Resized() (changes <-chan struct{}, stop func())
}
Terminal is the local terminal `falak console` drives. App.Terminal is nil when stdin isn't a terminal: no raw mode and no resizes (piped keystrokes still work).
func StdTerminal ¶
func StdTerminal() Terminal
StdTerminal is the process's terminal for `falak console`, or nil when stdin isn't one.
Source Files
¶
- app.go
- commands.go
- config.go
- configcheck.go
- configcmds.go
- configfile.go
- configruns.go
- console.go
- databases.go
- functions.go
- init.go
- initcompose.go
- initdetect.go
- initdockerfile.go
- initenv.go
- initupdate.go
- inityaml.go
- login.go
- mcp.go
- net.go
- netcapture.go
- output.go
- safewrite.go
- sandboxes.go
- sandboxes_snapshots.go
- secrets.go
- skill.go
- terminal.go
- terminal_unix.go
- update.go