Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CLI conversation more user-friendly #27

Open
bittner opened this issue Sep 15, 2020 · 0 comments
Open

Make CLI conversation more user-friendly #27

bittner opened this issue Sep 15, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@bittner
Copy link

bittner commented Sep 15, 2020

As a waf-tool user
I want the CLI to give me helpful (and beautiful) error messages
So that it's easy to get results with the CLI
And I do not necessarily need to study the README or consult other documentation.

Expected Outcome

  1. All error messages are self-explanatory and give directions on how to fix the situation.
  2. The layout of output (progress status, error and warning messages, etc.) have a common, pleasant, Unix CLI style look, targeted to human consumption.

Current State (Examples)

Confusing error message (should say, "Argument UNIQUEID required" instead)

$ waf-tool tune
FATAL[2020-09-15T11:09:32+02:00] An error occured             error="accepts 1 arg(s), received 0"

Confusing error message (should say, "Please log in to your cluster" instead)

$ waf-tool tune asdasd
INFO[2020-09-15T11:11:34+02:00] Starting port forward...      port=9200
FATAL[2020-09-15T11:11:34+02:00] An error occured             error="error: You must be logged in to the server (Unauthorized)"

The layout of any output is not particularly human-friendly. Logrus seems optimized for APIs that pick up the text for easy parsing ("Logrus is a structured logger for Go").

Colored

What to make use of

The help screens are implemented well (see below). There could be a related hint added to hard-to-understand error messages if their content can help understanding the usage (e.g. "Use --help for additional help.").

$ waf-tool
Usage:
  waf-tool [flags]
  waf-tool [command]

Available Commands:
  help        Help about any command
  tune        Create ModSecurity rule exclusions for a given request unique ID

Flags:
  -h, --help      help for waf-tool
  -v, --verbose   Verbose log output
      --version   version for waf-tool

Use "waf-tool [command] --help" for more information about a command.
$ waf-tool tune --help
The tool will use the oc binary to start a port forward to the cluster's Elasticsearch.
Using the $KUBECONFIG token it will query ES for the given unique ID.

Usage:
  waf-tool tune [unique-id] [flags]

Flags:
      --es-custom-ca string           Custom CA certificate to trust (in PEM format)
      --es-custom-ca-file string      Path to custom CA certificate to trust (in PEM format)
  -k, --es-insecure-skip-tls-verify   If true, the server's certificate will not be checked for validity.
                                      This will make your HTTPS connections insecure
  -u, --es-url string                 Elasticsearch target URL (default "https://localhost:9200/")
  -h, --help                          help for tune

Global Flags:
  -v, --verbose   Verbose log output
@bittner bittner added the enhancement New feature or request label Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant