A dynamic CLI client for Webda applications. The binary name determines which remote host it connects to, configured via ~/.webdacli/config.yaml.
go install github.com/loopingz/webda-cli@latestOr build from source:
go build -o myapp .
cp myapp /usr/local/bin/myappCreate symlinks for each remote host you want to connect to — the binary name maps to the config key:
ln -s /usr/local/bin/myapp /usr/local/bin/mystagingCreate ~/.webdacli/config.yaml with your host mappings:
myapp: https://app.example.com
mystaging: https://staging.example.com
wlocal: http://localhost:18080Each key is a command name. When you run myapp, it connects to https://app.example.com.
On first run, the CLI opens a browser for authentication. The token is stored in ~/.webdacli/<name>.tok and automatically refreshed in the background.
myapp # opens browser for auth on first run
myapp auth # re-authenticate
myapp whoami # show current user infoThe CLI fetches available operations from the remote host (GET /operations) and creates nested subcommands automatically. Operation names are split by . and converted to kebab-case:
| Operation | Command |
|---|---|
AuthorizerService.testOperations |
myapp authorizer-service test-operations |
MFA.SMS |
myapp mfa sms |
Sync.AWS |
myapp sync aws |
Operations are invoked via POST /operations/<operationId>.
If an operation defines an input JSON schema, flags are generated automatically:
myapp authorizer-service test-operations --user aliceWhen required fields are missing, an interactive TUI form is displayed to collect input. You can also force the form with --interactive / -i:
myapp authorizer-service test-operations # TUI triggers (--user is required)
myapp authorizer-service test-operations -i # force TUI even with all flags
myapp authorizer-service test-operations --user foo # no TUI, executes directlyGenerate a JSON skeleton for an operation's input schema, fill it in, then pass it back:
# Generate skeleton
myapp authorizer-service test-operations --generate-cli-skeleton > input.json
# Edit the file with your values
cat input.json
{
"user": ""
}
# Run the operation with the file
myapp authorizer-service test-operations --input input.jsonFlags override values from the file. The TUI form can fill remaining gaps:
# File provides some values, --user overrides, TUI fills the rest
myapp authorizer-service test-operations --input partial.json --user alice -imyapp refresh-operations # re-fetch operations from the serverShell completion is automatically installed on first launch. The CLI detects your shell (zsh, bash, or fish) and installs the appropriate completion script.
- zsh: Writes to
~/.webdacli/completions/_<name>and addsfpathto~/.zshrc - bash: Writes to
~/.webdacli/completions/<name>.bashand sources it from~/.bashrc - fish: Writes to
~/.config/fish/completions/<name>.fish
After the first launch, restart your shell (or source ~/.zshrc) to activate completion.
To manually regenerate:
myapp completion zsh > ~/.webdacli/completions/_myapp
myapp completion bash > ~/.webdacli/completions/myapp.bash
myapp completion fish > ~/.config/fish/completions/myapp.fishIf the server provides a logo URL in the operations response, the CLI displays it inline in terminals that support it (iTerm2, Kitty, WezTerm). The logo appears in help output and interactive TUI forms.
After cloning, enable the pre-push hook to run linting and tests before each push:
git config core.hooksPath .githooksThis runs go vet, golangci-lint, and go test -race automatically.
| Path | Purpose |
|---|---|
~/.webdacli/config.yaml |
Host mappings |
~/.webdacli/<name>.tok |
Authentication tokens |
~/.webdacli/<name>.operations |
Cached operations spec |
~/.webdacli/<name>.logo |
Cached logo image |
~/.webdacli/completions/ |
Shell completion scripts |