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

Better formatting of help text in terminals #34

Open
qa-swaneet-sahoo opened this issue Apr 22, 2022 · 0 comments
Open

Better formatting of help text in terminals #34

qa-swaneet-sahoo opened this issue Apr 22, 2022 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@qa-swaneet-sahoo
Copy link
Collaborator

qa-swaneet-sahoo commented Apr 22, 2022

When running protocurl -h, the description of flags/arguments is not warped properly in the terminal.

It would be better to manually warp the usage text and ensure, that it fit within a specific width (e.g. 80 characters) - just like what other command line tools such as protoc -h do as well.

It is unclear, whether there is an option in cobra which automatically
adds newlines to ensure proper formatting.

The output should look similar to this:

Usage: protoc.exe [OPTION] PROTO_FILES
Parse PROTO_FILES and generate output based on the options given:
  -IPATH, --proto_path=PATH   Specify the directory in which to search for
                              imports.  May be specified multiple times;
                              directories will be searched in order.  If not
                              given, the current working directory is used.
                              If not found in any of the these directories,
                              the --descriptor_set_in descriptors will be
                              checked for required proto file.
  --version                   Show version info and exit.
  -h, --help                  Show this text and exit.
  --encode=MESSAGE_TYPE       Read a text-format message of the given type
                              from standard input and write it in binary
                              to standard output.  The message type must
                              be defined in PROTO_FILES or their imports.
  --deterministic_output      When using --encode, ensure map fields are
                              deterministically ordered. Note that this order
                              is not canonical, and changes across builds or

An implementation should not directly change the usage text for the flags. The usage for the flags should be written without any newlines - and a separate "rendering" function should take care of the formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Development

No branches or pull requests

2 participants