Rename proboctl CLI binary to prb
Shorter CLI name for faster typing. Renames the binary, build targets, goreleaser config, command examples, and documentation. Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -46,9 +46,9 @@ builds:
|
|||||||
ignore:
|
ignore:
|
||||||
- goos: windows
|
- goos: windows
|
||||||
goarch: arm64
|
goarch: arm64
|
||||||
- id: proboctl
|
- id: prb
|
||||||
main: ./cmd/proboctl/main.go
|
main: ./cmd/prb/main.go
|
||||||
binary: proboctl
|
binary: prb
|
||||||
ldflags:
|
ldflags:
|
||||||
- -s -w
|
- -s -w
|
||||||
- -X 'main.version={{.Version}}'
|
- -X 'main.version={{.Version}}'
|
||||||
@@ -96,9 +96,9 @@ builds:
|
|||||||
goarch:
|
goarch:
|
||||||
- amd64
|
- amd64
|
||||||
- arm64
|
- arm64
|
||||||
- id: proboctl-docker
|
- id: prb-docker
|
||||||
main: ./cmd/proboctl/main.go
|
main: ./cmd/prb/main.go
|
||||||
binary: proboctl
|
binary: prb
|
||||||
ldflags:
|
ldflags:
|
||||||
- -s -w
|
- -s -w
|
||||||
- -X 'main.version={{.Version}}'
|
- -X 'main.version={{.Version}}'
|
||||||
@@ -116,7 +116,7 @@ archives:
|
|||||||
- builds:
|
- builds:
|
||||||
- probod
|
- probod
|
||||||
- probod-bootstrap
|
- probod-bootstrap
|
||||||
- proboctl
|
- prb
|
||||||
name_template: >-
|
name_template: >-
|
||||||
{{ .ProjectName }}_
|
{{ .ProjectName }}_
|
||||||
{{- title .Os }}_
|
{{- title .Os }}_
|
||||||
|
|||||||
12
GNUmakefile
12
GNUmakefile
@@ -46,8 +46,8 @@ PROBOD_BIN_EXTRA_DEPS=
|
|||||||
PROBOD_BIN= bin/probod
|
PROBOD_BIN= bin/probod
|
||||||
PROBOD_SRC= cmd/probod/main.go
|
PROBOD_SRC= cmd/probod/main.go
|
||||||
|
|
||||||
PROBOCTL_BIN= bin/proboctl
|
PRB_BIN= bin/prb
|
||||||
PROBOCTL_SRC= cmd/proboctl/main.go
|
PRB_SRC= cmd/prb/main.go
|
||||||
|
|
||||||
ifndef SKIP_APPS
|
ifndef SKIP_APPS
|
||||||
PROBOD_BIN_EXTRA_DEPS += \
|
PROBOD_BIN_EXTRA_DEPS += \
|
||||||
@@ -122,7 +122,7 @@ coverage-combined: coverage-report test-e2e-coverage ## Generate combined covera
|
|||||||
$(GO) tool cover -html=coverage-combined.out -o=coverage-combined.html
|
$(GO) tool cover -html=coverage-combined.out -o=coverage-combined.html
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: bin/probod bin/proboctl
|
build: bin/probod bin/prb
|
||||||
|
|
||||||
.PHONY: sbom-docker
|
.PHONY: sbom-docker
|
||||||
sbom-docker: docker-build
|
sbom-docker: docker-build
|
||||||
@@ -179,9 +179,9 @@ bin/probod: pkg/server/api/connect/v1/schema/schema.go \
|
|||||||
@probo/emails
|
@probo/emails
|
||||||
$(GO_BUILD) -o $(PROBOD_BIN) $(PROBOD_SRC)
|
$(GO_BUILD) -o $(PROBOD_BIN) $(PROBOD_SRC)
|
||||||
|
|
||||||
.PHONY: bin/proboctl
|
.PHONY: bin/prb
|
||||||
bin/proboctl:
|
bin/prb:
|
||||||
$(GO_BUILD) -o $(PROBOCTL_BIN) $(PROBOCTL_SRC)
|
$(GO_BUILD) -o $(PRB_BIN) $(PRB_SRC)
|
||||||
|
|
||||||
.PHONY: @probo/emails
|
.PHONY: @probo/emails
|
||||||
@probo/emails:
|
@probo/emails:
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ func (c *Client) DoRaw(
|
|||||||
|
|
||||||
req.Header.Set("Content-Type", "application/json")
|
req.Header.Set("Content-Type", "application/json")
|
||||||
req.Header.Set("Authorization", "Bearer "+c.token)
|
req.Header.Set("Authorization", "Bearer "+c.token)
|
||||||
req.Header.Set("User-Agent", version.UserAgent("proboctl"))
|
req.Header.Set("User-Agent", version.UserAgent("prb"))
|
||||||
|
|
||||||
resp, err := c.httpClient.Do(req)
|
resp, err := c.httpClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -120,7 +120,7 @@ func (c *Client) DoRaw(
|
|||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
case http.StatusUnauthorized:
|
case http.StatusUnauthorized:
|
||||||
return nil, fmt.Errorf("authentication failed (HTTP 401): token may be invalid or expired, try 'proboctl auth login'")
|
return nil, fmt.Errorf("authentication failed (HTTP 401): token may be invalid or expired, try 'prb auth login'")
|
||||||
case http.StatusForbidden:
|
case http.StatusForbidden:
|
||||||
return nil, fmt.Errorf("access denied (HTTP 403): you do not have permission to perform this action")
|
return nil, fmt.Errorf("access denied (HTTP 403): you do not have permission to perform this action")
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ func configDir() (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("cannot determine config directory: %w", err)
|
return "", fmt.Errorf("cannot determine config directory: %w", err)
|
||||||
}
|
}
|
||||||
return filepath.Join(dir, "proboctl"), nil
|
return filepath.Join(dir, "prb"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func configPath() (string, error) {
|
func configPath() (string, error) {
|
||||||
@@ -188,7 +188,7 @@ func (c *Config) DefaultHost() (string, *HostConfig, error) {
|
|||||||
|
|
||||||
if token := os.Getenv("PROBO_TOKEN"); token != "" {
|
if token := os.Getenv("PROBO_TOKEN"); token != "" {
|
||||||
if len(hosts) == 0 {
|
if len(hosts) == 0 {
|
||||||
return "", nil, fmt.Errorf("PROBO_TOKEN is set but no host configured; run 'proboctl auth login' first")
|
return "", nil, fmt.Errorf("PROBO_TOKEN is set but no host configured; run 'prb auth login' first")
|
||||||
}
|
}
|
||||||
|
|
||||||
host := hosts[0]
|
host := hosts[0]
|
||||||
@@ -215,5 +215,5 @@ func (c *Config) DefaultHost() (string, *HostConfig, error) {
|
|||||||
return host, c.Hosts[host], nil
|
return host, c.Hosts[host], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", nil, fmt.Errorf("not logged in; run 'proboctl auth login' first")
|
return "", nil, fmt.Errorf("not logged in; run 'prb auth login' first")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# AGENTS.md — proboctl CLI
|
# AGENTS.md — prb CLI
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
`proboctl` is the Probo CLI built with [cobra](https://github.com/spf13/cobra). Entry point: `cmd/proboctl/main.go`.
|
`prb` is the Probo CLI built with [cobra](https://github.com/spf13/cobra). Entry point: `cmd/prb/main.go`.
|
||||||
|
|
||||||
## Package layout
|
## Package layout
|
||||||
|
|
||||||
| Package | Purpose |
|
| Package | Purpose |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `cmd/proboctl` | Binary entry point — creates `Factory`, root command, and runs it |
|
| `cmd/prb` | Binary entry point — creates `Factory`, root command, and runs it |
|
||||||
| `pkg/cmd/root` | Root command — registers all top-level subcommands |
|
| `pkg/cmd/root` | Root command — registers all top-level subcommands |
|
||||||
| `pkg/cmd/<resource>` | Command group (e.g. `risk`, `framework`, `webhook`) — wires subcommands |
|
| `pkg/cmd/<resource>` | Command group (e.g. `risk`, `framework`, `webhook`) — wires subcommands |
|
||||||
| `pkg/cmd/<resource>/<verb>` | Leaf command (e.g. `risk/create`, `risk/list`) — owns the `RunE` |
|
| `pkg/cmd/<resource>/<verb>` | Leaf command (e.g. `risk/create`, `risk/list`) — owns the `RunE` |
|
||||||
@@ -41,7 +41,7 @@ func NewCmd<Verb>(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Use: "<verb>",
|
Use: "<verb>",
|
||||||
Short: "One-line description",
|
Short: "One-line description",
|
||||||
Aliases: []string{"..."}, // optional, e.g. "ls" for list
|
Aliases: []string{"..."}, // optional, e.g. "ls" for list
|
||||||
Example: ` proboctl <resource> <verb> ...`,
|
Example: ` prb <resource> <verb> ...`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
// 1. Validate output flags (for list commands)
|
// 1. Validate output flags (for list commands)
|
||||||
// 2. Load config, get host + token
|
// 2. Load config, get host + token
|
||||||
@@ -64,7 +64,7 @@ func NewCmd<Verb>(f *cmdutil.Factory) *cobra.Command {
|
|||||||
|
|
||||||
- **GraphQL queries/mutations** are `const` strings declared at package level in the leaf command file.
|
- **GraphQL queries/mutations** are `const` strings declared at package level in the leaf command file.
|
||||||
- **Response types** are unexported structs in the leaf command file, shaped to match the GraphQL response.
|
- **Response types** are unexported structs in the leaf command file, shaped to match the GraphQL response.
|
||||||
- **Organization resolution**: every command that needs an org checks `--org` flag first, then falls back to `hc.Organization` from config. If both are empty, return an error telling the user to pass `--org` or run `proboctl auth login`.
|
- **Organization resolution**: every command that needs an org checks `--org` flag first, then falls back to `hc.Organization` from config. If both are empty, return an error telling the user to pass `--org` or run `prb auth login`.
|
||||||
- **Interactive prompts** use `github.com/charmbracelet/huh`. Gate them behind `f.IOStreams.IsInteractive()`. Always support full non-interactive use via flags.
|
- **Interactive prompts** use `github.com/charmbracelet/huh`. Gate them behind `f.IOStreams.IsInteractive()`. Always support full non-interactive use via flags.
|
||||||
- **Output format**: list commands support `--output json|table` via `cmdutil.AddOutputFlag` / `cmdutil.ValidateOutputFlag`. Default is table.
|
- **Output format**: list commands support `--output json|table` via `cmdutil.AddOutputFlag` / `cmdutil.ValidateOutputFlag`. Default is table.
|
||||||
- **Pagination**: list commands use `api.Paginate[T]` with a `--limit` / `-L` flag (default 30). Show "Showing X of Y" on stderr when results are truncated.
|
- **Pagination**: list commands use `api.Paginate[T]` with a `--limit` / `-L` flag (default 30). Show "Showing X of Y" on stderr when results are truncated.
|
||||||
|
|||||||
@@ -44,17 +44,17 @@ func NewCmdAPI(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Short: "Make an authenticated GraphQL request",
|
Short: "Make an authenticated GraphQL request",
|
||||||
Long: "Send a GraphQL query or mutation to the Probo API and print the response.",
|
Long: "Send a GraphQL query or mutation to the Probo API and print the response.",
|
||||||
Example: ` # Run a query against the console schema (default)
|
Example: ` # Run a query against the console schema (default)
|
||||||
proboctl api 'query { viewer { id email } }'
|
prb api 'query { viewer { id email } }'
|
||||||
|
|
||||||
# Run a mutation with variables
|
# Run a mutation with variables
|
||||||
proboctl api 'mutation($input: CreateRiskInput!) { createRisk(input: $input) { riskEdge { node { id } } } }' \
|
prb api 'mutation($input: CreateRiskInput!) { createRisk(input: $input) { riskEdge { node { id } } } }' \
|
||||||
-f input='{"organizationId":"...","name":"Test","category":"Operational","treatment":"ACCEPTED","inherentLikelihood":3,"inherentImpact":3}'
|
-f input='{"organizationId":"...","name":"Test","category":"Operational","treatment":"ACCEPTED","inherentLikelihood":3,"inherentImpact":3}'
|
||||||
|
|
||||||
# Query the connect schema
|
# Query the connect schema
|
||||||
proboctl api --schema connect 'query { viewer { id email } }'
|
prb api --schema connect 'query { viewer { id email } }'
|
||||||
|
|
||||||
# Read query from stdin
|
# Read query from stdin
|
||||||
echo '{ viewer { id } }' | proboctl api -`,
|
echo '{ viewer { id } }' | prb api -`,
|
||||||
Args: cobra.MaximumNArgs(1),
|
Args: cobra.MaximumNArgs(1),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
endpoint, ok := schemaEndpoints[flagSchema]
|
endpoint, ok := schemaEndpoints[flagSchema]
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
func NewCmdAuth(f *cmdutil.Factory) *cobra.Command {
|
func NewCmdAuth(f *cmdutil.Factory) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "auth <command>",
|
Use: "auth <command>",
|
||||||
Short: "Authenticate proboctl with Probo",
|
Short: "Authenticate prb with Probo",
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.AddCommand(login.NewCmdLogin(f))
|
cmd.AddCommand(login.NewCmdLogin(f))
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ func NewCmdLogin(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Use: "login",
|
Use: "login",
|
||||||
Short: "Authenticate with a Probo host",
|
Short: "Authenticate with a Probo host",
|
||||||
Example: ` # Interactive login (prompts for hostname, token, and org)
|
Example: ` # Interactive login (prompts for hostname, token, and org)
|
||||||
proboctl auth login
|
prb auth login
|
||||||
|
|
||||||
# Non-interactive login
|
# Non-interactive login
|
||||||
proboctl auth login --hostname app.getprobo.com --token <token> --org <org-id>`,
|
prb auth login --hostname app.getprobo.com --token <token> --org <org-id>`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if f.IOStreams.IsInteractive() {
|
if f.IOStreams.IsInteractive() {
|
||||||
if flagHost == "" {
|
if flagHost == "" {
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ func NewCmdLogout(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Use: "logout",
|
Use: "logout",
|
||||||
Short: "Log out of a Probo host",
|
Short: "Log out of a Probo host",
|
||||||
Example: ` # Log out of the active host
|
Example: ` # Log out of the active host
|
||||||
proboctl auth logout
|
prb auth logout
|
||||||
|
|
||||||
# Log out of a specific host
|
# Log out of a specific host
|
||||||
proboctl auth logout --hostname app.getprobo.com`,
|
prb auth logout --hostname app.getprobo.com`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cfg, err := f.Config()
|
cfg, err := f.Config()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func NewCmdStatus(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Use: "status",
|
Use: "status",
|
||||||
Short: "View authentication status",
|
Short: "View authentication status",
|
||||||
Example: ` # Show all configured hosts and their authentication status
|
Example: ` # Show all configured hosts and their authentication status
|
||||||
proboctl auth status`,
|
prb auth status`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cfg, err := f.Config()
|
cfg, err := f.Config()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ func NewCmdBrowse(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Long: "Open the Probo console in the default web browser.",
|
Long: "Open the Probo console in the default web browser.",
|
||||||
Aliases: []string{"open"},
|
Aliases: []string{"open"},
|
||||||
Example: ` # Open the Probo console in the browser
|
Example: ` # Open the Probo console in the browser
|
||||||
proboctl browse
|
prb browse
|
||||||
|
|
||||||
# Print the URL without opening the browser
|
# Print the URL without opening the browser
|
||||||
proboctl browse --no-browser
|
prb browse --no-browser
|
||||||
|
|
||||||
# Open a specific organization
|
# Open a specific organization
|
||||||
proboctl browse --org <org-id>`,
|
prb browse --org <org-id>`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cfg, err := f.Config()
|
cfg, err := f.Config()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -25,32 +25,32 @@ func NewCmdCompletion(f *cmdutil.Factory) *cobra.Command {
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "completion <shell>",
|
Use: "completion <shell>",
|
||||||
Short: "Generate shell completion scripts",
|
Short: "Generate shell completion scripts",
|
||||||
Long: `Generate shell completion scripts for proboctl.
|
Long: `Generate shell completion scripts for prb.
|
||||||
|
|
||||||
To load completions:
|
To load completions:
|
||||||
|
|
||||||
Bash:
|
Bash:
|
||||||
$ source <(proboctl completion bash)
|
$ source <(prb completion bash)
|
||||||
# To load completions for each session, execute once:
|
# To load completions for each session, execute once:
|
||||||
# Linux:
|
# Linux:
|
||||||
$ proboctl completion bash > /etc/bash_completion.d/proboctl
|
$ prb completion bash > /etc/bash_completion.d/prb
|
||||||
# macOS:
|
# macOS:
|
||||||
$ proboctl completion bash > $(brew --prefix)/etc/bash_completion.d/proboctl
|
$ prb completion bash > $(brew --prefix)/etc/bash_completion.d/prb
|
||||||
|
|
||||||
Zsh:
|
Zsh:
|
||||||
$ source <(proboctl completion zsh)
|
$ source <(prb completion zsh)
|
||||||
# To load completions for each session, execute once:
|
# To load completions for each session, execute once:
|
||||||
$ proboctl completion zsh > "${fpath[1]}/_proboctl"
|
$ prb completion zsh > "${fpath[1]}/_prb"
|
||||||
|
|
||||||
Fish:
|
Fish:
|
||||||
$ proboctl completion fish | source
|
$ prb completion fish | source
|
||||||
# To load completions for each session, execute once:
|
# To load completions for each session, execute once:
|
||||||
$ proboctl completion fish > ~/.config/fish/completions/proboctl.fish
|
$ prb completion fish > ~/.config/fish/completions/prb.fish
|
||||||
|
|
||||||
PowerShell:
|
PowerShell:
|
||||||
PS> proboctl completion powershell | Out-String | Invoke-Expression
|
PS> prb completion powershell | Out-String | Invoke-Expression
|
||||||
# To load completions for each session, execute once:
|
# To load completions for each session, execute once:
|
||||||
PS> proboctl completion powershell > proboctl.ps1`,
|
PS> prb completion powershell > prb.ps1`,
|
||||||
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
|
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
|
||||||
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
|
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
func NewCmdConfig(f *cmdutil.Factory) *cobra.Command {
|
func NewCmdConfig(f *cmdutil.Factory) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "config <command>",
|
Use: "config <command>",
|
||||||
Short: "Manage configuration for proboctl",
|
Short: "Manage configuration for prb",
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.AddCommand(configget.NewCmdConfigGet(f))
|
cmd.AddCommand(configget.NewCmdConfigGet(f))
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ func NewCmdConfigGet(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Short: "Print the value of a given configuration key",
|
Short: "Print the value of a given configuration key",
|
||||||
Long: "Print the value of a given configuration key.\n\nAvailable keys: editor, browser, pager, prompt, http_timeout",
|
Long: "Print the value of a given configuration key.\n\nAvailable keys: editor, browser, pager, prompt, http_timeout",
|
||||||
Example: ` # Get the configured editor
|
Example: ` # Get the configured editor
|
||||||
proboctl config get editor
|
prb config get editor
|
||||||
|
|
||||||
# Get the HTTP timeout
|
# Get the HTTP timeout
|
||||||
proboctl config get http_timeout`,
|
prb config get http_timeout`,
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cfg, err := f.Config()
|
cfg, err := f.Config()
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ func NewCmdConfigSet(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Short: "Update configuration with a value for the given key",
|
Short: "Update configuration with a value for the given key",
|
||||||
Long: "Update configuration with a value for the given key.\n\nAvailable keys: editor, browser, pager, prompt, http_timeout",
|
Long: "Update configuration with a value for the given key.\n\nAvailable keys: editor, browser, pager, prompt, http_timeout",
|
||||||
Example: ` # Set the default editor
|
Example: ` # Set the default editor
|
||||||
proboctl config set editor vim
|
prb config set editor vim
|
||||||
|
|
||||||
# Set the HTTP timeout to 60 seconds
|
# Set the HTTP timeout to 60 seconds
|
||||||
proboctl config set http_timeout 60s
|
prb config set http_timeout 60s
|
||||||
|
|
||||||
# Disable interactive prompts
|
# Disable interactive prompts
|
||||||
proboctl config set prompt disabled`,
|
prb config set prompt disabled`,
|
||||||
Args: cobra.ExactArgs(2),
|
Args: cobra.ExactArgs(2),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cfg, err := f.Config()
|
cfg, err := f.Config()
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Use: "create",
|
Use: "create",
|
||||||
Short: "Create a new control",
|
Short: "Create a new control",
|
||||||
Example: ` # Create a control
|
Example: ` # Create a control
|
||||||
proboctl control create --framework FW_ID --section-title "A.5" --name "Information security policies"`,
|
prb control create --framework FW_ID --section-title "A.5" --name "Information security policies"`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cfg, err := f.Config()
|
cfg, err := f.Config()
|
||||||
|
|||||||
@@ -72,10 +72,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Short: "List controls in a framework",
|
Short: "List controls in a framework",
|
||||||
Aliases: []string{"ls"},
|
Aliases: []string{"ls"},
|
||||||
Example: ` # List controls in a framework
|
Example: ` # List controls in a framework
|
||||||
proboctl control list --framework <framework-id>
|
prb control list --framework <framework-id>
|
||||||
|
|
||||||
# Filter and output as JSON
|
# Filter and output as JSON
|
||||||
proboctl control ls --framework <framework-id> --filter "access" --json`,
|
prb control ls --framework <framework-id> --filter "access" --json`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if err := cmdutil.ValidateOutputFlag(flagOutput); err != nil {
|
if err := cmdutil.ValidateOutputFlag(flagOutput); err != nil {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Use: "create",
|
Use: "create",
|
||||||
Short: "Create a new framework",
|
Short: "Create a new framework",
|
||||||
Example: ` # Create a framework
|
Example: ` # Create a framework
|
||||||
proboctl framework create --name "ISO 27001:2022" --description "Information security standard"`,
|
prb framework create --name "ISO 27001:2022" --description "Information security standard"`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cfg, err := f.Config()
|
cfg, err := f.Config()
|
||||||
@@ -85,7 +85,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if flagOrg == "" {
|
if flagOrg == "" {
|
||||||
return fmt.Errorf("organization is required; pass --org or set a default with 'proboctl auth login'")
|
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
|
||||||
}
|
}
|
||||||
|
|
||||||
input := map[string]any{
|
input := map[string]any{
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if flagOrg == "" {
|
if flagOrg == "" {
|
||||||
return fmt.Errorf("organization is required; pass --org or set a default with 'proboctl auth login'")
|
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
|
||||||
}
|
}
|
||||||
|
|
||||||
variables := map[string]any{
|
variables := map[string]any{
|
||||||
|
|||||||
@@ -79,10 +79,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Short: "List organizations you have access to",
|
Short: "List organizations you have access to",
|
||||||
Aliases: []string{"ls"},
|
Aliases: []string{"ls"},
|
||||||
Example: ` # List all organizations
|
Example: ` # List all organizations
|
||||||
proboctl org list
|
prb org list
|
||||||
|
|
||||||
# Output as JSON
|
# Output as JSON
|
||||||
proboctl org ls --json`,
|
prb org ls --json`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if err := cmdutil.ValidateOutputFlag(flagOutput); err != nil {
|
if err := cmdutil.ValidateOutputFlag(flagOutput); err != nil {
|
||||||
|
|||||||
@@ -83,10 +83,10 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Use: "create",
|
Use: "create",
|
||||||
Short: "Create a new risk",
|
Short: "Create a new risk",
|
||||||
Example: ` # Create a risk interactively
|
Example: ` # Create a risk interactively
|
||||||
proboctl risk create --inherent-likelihood 3 --inherent-impact 4
|
prb risk create --inherent-likelihood 3 --inherent-impact 4
|
||||||
|
|
||||||
# Create a risk non-interactively
|
# Create a risk non-interactively
|
||||||
proboctl risk create --name "Data breach" --category "Security" --treatment MITIGATED --inherent-likelihood 3 --inherent-impact 4`,
|
prb risk create --name "Data breach" --category "Security" --treatment MITIGATED --inherent-likelihood 3 --inherent-impact 4`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cfg, err := f.Config()
|
cfg, err := f.Config()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -110,7 +110,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if flagOrg == "" {
|
if flagOrg == "" {
|
||||||
return fmt.Errorf("organization is required; pass --org or set a default with 'proboctl auth login'")
|
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.IOStreams.IsInteractive() {
|
if f.IOStreams.IsInteractive() {
|
||||||
|
|||||||
@@ -74,13 +74,13 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Short: "List risks in an organization",
|
Short: "List risks in an organization",
|
||||||
Aliases: []string{"ls"},
|
Aliases: []string{"ls"},
|
||||||
Example: ` # List risks in the default organization
|
Example: ` # List risks in the default organization
|
||||||
proboctl risk list
|
prb risk list
|
||||||
|
|
||||||
# Filter risks by name
|
# Filter risks by name
|
||||||
proboctl risk list --filter "data breach"
|
prb risk list --filter "data breach"
|
||||||
|
|
||||||
# List risks sorted by inherent score
|
# List risks sorted by inherent score
|
||||||
proboctl risk ls --order-by INHERENT_RISK_SCORE --json`,
|
prb risk ls --order-by INHERENT_RISK_SCORE --json`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if err := cmdutil.ValidateOutputFlag(flagOutput); err != nil {
|
if err := cmdutil.ValidateOutputFlag(flagOutput); err != nil {
|
||||||
@@ -109,7 +109,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if flagOrg == "" {
|
if flagOrg == "" {
|
||||||
return fmt.Errorf("organization is required; pass --org or set a default with 'proboctl auth login'")
|
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
|
||||||
}
|
}
|
||||||
|
|
||||||
variables := map[string]any{
|
variables := map[string]any{
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ import (
|
|||||||
|
|
||||||
func NewCmdRoot(f *cmdutil.Factory) *cobra.Command {
|
func NewCmdRoot(f *cmdutil.Factory) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "proboctl <command> [flags]",
|
Use: "prb <command> [flags]",
|
||||||
Short: "Probo CLI",
|
Short: "Probo CLI",
|
||||||
Long: "proboctl is a command-line tool for interacting with the Probo platform.",
|
Long: "prb is a command-line tool for interacting with the Probo platform.",
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
SilenceErrors: true,
|
SilenceErrors: true,
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Use: "create",
|
Use: "create",
|
||||||
Short: "Create a new statement of applicability",
|
Short: "Create a new statement of applicability",
|
||||||
Example: ` # Create a statement of applicability
|
Example: ` # Create a statement of applicability
|
||||||
proboctl soa create --name "ISO 27001 SoA" --owner PROFILE_ID`,
|
prb soa create --name "ISO 27001 SoA" --owner PROFILE_ID`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cfg, err := f.Config()
|
cfg, err := f.Config()
|
||||||
@@ -85,7 +85,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if flagOrg == "" {
|
if flagOrg == "" {
|
||||||
return fmt.Errorf("organization is required; pass --org or set a default with 'proboctl auth login'")
|
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
|
||||||
}
|
}
|
||||||
|
|
||||||
input := map[string]any{
|
input := map[string]any{
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if flagOrg == "" {
|
if flagOrg == "" {
|
||||||
return fmt.Errorf("organization is required; pass --org or set a default with 'proboctl auth login'")
|
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
|
||||||
}
|
}
|
||||||
|
|
||||||
variables := map[string]any{
|
variables := map[string]any{
|
||||||
|
|||||||
@@ -73,10 +73,10 @@ func NewCmdAdd(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Use: "add",
|
Use: "add",
|
||||||
Short: "Add an applicability statement to a SoA",
|
Short: "Add an applicability statement to a SoA",
|
||||||
Example: ` # Add a control as applicable
|
Example: ` # Add a control as applicable
|
||||||
proboctl soa statement add --soa SOA_ID --control CTRL_ID --applicable
|
prb soa statement add --soa SOA_ID --control CTRL_ID --applicable
|
||||||
|
|
||||||
# Add a control as not applicable with justification
|
# Add a control as not applicable with justification
|
||||||
proboctl soa statement add --soa SOA_ID --control CTRL_ID --not-applicable --justification "Not in scope"`,
|
prb soa statement add --soa SOA_ID --control CTRL_ID --not-applicable --justification "Not in scope"`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if flagApplicable && flagNotApplicable {
|
if flagApplicable && flagNotApplicable {
|
||||||
|
|||||||
@@ -74,10 +74,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Short: "List users in an organization",
|
Short: "List users in an organization",
|
||||||
Aliases: []string{"ls"},
|
Aliases: []string{"ls"},
|
||||||
Example: ` # List users in the default organization
|
Example: ` # List users in the default organization
|
||||||
proboctl user list
|
prb user list
|
||||||
|
|
||||||
# List only active users as JSON
|
# List only active users as JSON
|
||||||
proboctl user ls --active --json`,
|
prb user ls --active --json`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if err := cmdutil.ValidateOutputFlag(flagOutput); err != nil {
|
if err := cmdutil.ValidateOutputFlag(flagOutput); err != nil {
|
||||||
@@ -106,7 +106,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if flagOrg == "" {
|
if flagOrg == "" {
|
||||||
return fmt.Errorf("organization is required; pass --org or set a default with 'proboctl auth login'")
|
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
|
||||||
}
|
}
|
||||||
|
|
||||||
variables := map[string]any{
|
variables := map[string]any{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
func NewCmdVersion(f *cmdutil.Factory) *cobra.Command {
|
func NewCmdVersion(f *cmdutil.Factory) *cobra.Command {
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "version",
|
Use: "version",
|
||||||
Short: "Print the version of proboctl",
|
Short: "Print the version of prb",
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
info := version.GetBuildInfo()
|
info := version.GetBuildInfo()
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ func NewCmdVersion(f *cmdutil.Factory) *cobra.Command {
|
|||||||
|
|
||||||
_, _ = fmt.Fprintf(
|
_, _ = fmt.Fprintf(
|
||||||
f.IOStreams.Out,
|
f.IOStreams.Out,
|
||||||
"proboctl version %s (commit: %s, built: %s, go: %s)\n",
|
"prb version %s (commit: %s, built: %s, go: %s)\n",
|
||||||
v,
|
v,
|
||||||
info.Commit,
|
info.Commit,
|
||||||
info.BuildDate,
|
info.BuildDate,
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
Use: "create",
|
Use: "create",
|
||||||
Short: "Create a webhook subscription",
|
Short: "Create a webhook subscription",
|
||||||
Example: ` # Create a webhook for all meeting events
|
Example: ` # Create a webhook for all meeting events
|
||||||
proboctl webhook create --url https://example.com/webhook --event MEETING_CREATED --event MEETING_UPDATED
|
prb webhook create --url https://example.com/webhook --event MEETING_CREATED --event MEETING_UPDATED
|
||||||
|
|
||||||
# Create a webhook for all supported events
|
# Create a webhook for all supported events
|
||||||
proboctl webhook create --url https://example.com/webhook --event MEETING_CREATED --event MEETING_UPDATED --event MEETING_DELETED --event VENDOR_CREATED --event VENDOR_UPDATED --event VENDOR_DELETED`,
|
prb webhook create --url https://example.com/webhook --event MEETING_CREATED --event MEETING_UPDATED --event MEETING_DELETED --event VENDOR_CREATED --event VENDOR_UPDATED --event VENDOR_DELETED`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
for _, e := range flagEvents {
|
for _, e := range flagEvents {
|
||||||
@@ -103,7 +103,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if flagOrg == "" {
|
if flagOrg == "" {
|
||||||
return fmt.Errorf("organization is required; pass --org or set a default with 'proboctl auth login'")
|
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
|
||||||
}
|
}
|
||||||
|
|
||||||
input := map[string]any{
|
input := map[string]any{
|
||||||
|
|||||||
Reference in New Issue
Block a user