FairwindsOps / pluto

A cli tool to help discover deprecated apiVersions in Kubernetes
https://fairwinds.com
Apache License 2.0
2.14k stars 124 forks source link

Docs: misleading example of how to use --columns option #501

Closed DLakin01 closed 1 year ago

DLakin01 commented 1 year ago

What happened?

In the Advanced Usage section of the Pluto docs, there are examples of using the --columns option to control which columns appear in the output. Some of the examples include columns with an interior space, such as "DEPRECATED IN" or "REMOVED IN". The example code shows those columns being specified without any wrapping quotes, like so:

pluto detect-api-resources -o markdown --columns NAME,NAMESPACE,KIND,VERSION,REPLACEMENT,DEPRECATED,DEPRECATED IN,REMOVED,REMOVED IN

However, when the results appear, the first column containing a space is truncated, producing a duplicate "DEPRECATED" column, and no further columns are displayed

What did you expect to happen?

Either the docs should be updated to use quotes around columns like DEPRECATED IN, or the CLI tool should handle the non-quoted version properly

How can we reproduce this?

Run the following command to see the truncation:

pluto detect-api-resources -o markdown --columns NAME,NAMESPACE,KIND,VERSION,REPLACEMENT,DEPRECATED,DEPRECATED IN,REMOVED,REMOVED IN

Version

5.18.1

Search

Code of Conduct

Additional context

No response

sudermanjr commented 1 year ago

Thanks for the details!

You don't actually need to quote, you just need to escape the space pluto detect-api-resources -o markdown --columns NAME,NAMESPACE,KIND,VERSION,REPLACEMENT,DEPRECATED,DEPRECATED\ IN,REMOVED,REMOVED\ IN

I agree, the docs should be updated. I don't believe there's a way to make cobra automatically escape the spaces in the CLI, since that's really more of a shell problem than a code problem.