doctl icon indicating copy to clipboard operation
doctl copied to clipboard

Some inconsistencies in enum argument descriptions

Open zikalino opened this issue 1 year ago • 4 comments

Describe the Issue:

I have done some more investigation related to this PR: https://github.com/digitalocean/doctl/pull/1595, and I found more related issues / inconsistencies.

For instance in doctl databases topics update:

 --cleanup-policy string              Specifies the retention policy to use on log segments: Possible values are 'delete', 'compact_delete', 'compact' (default "delete")
 --compression-type string            Specifies the compression type for a kafka topic: Possible values are 'producer', 'gzip', 'snappy', 'Iz4', 'zstd', 'uncompressed' (default "producer")

but in doctl databases create and most other places:

--engine pg                          The database's engine. Possible values are: pg, `mysql`, `redis`, `mongodb`, `kafka` and `opensearch`. (default "pg")

In the first example, apostrophes don't interfere with command argument type generation and it stays defined as string. In the second example, backticks are causing to use first value (pg) as data type for argument, which can be confusing.

I would be happy to create PR to fix this, however, I am not sure whether there's any reason attached to using backticks versus apostrophes. I am also not sure why default value is in quotes.

One possible solution is to introduce enum data type, and then argument descriptions could look like this:

--engine enum                          The database's engine. Possible enum values are: `pg`, `mysql`, `redis`, `mongodb`, `kafka` and `opensearch`. (default "pg")

zikalino avatar Oct 19 '24 05:10 zikalino

Thanks for looking into this @zikalino!

The one positive to the backticks is that they display as code in the online version of the documentation:

https://docs.digitalocean.com/reference/doctl/reference/databases/create/

I am also not sure why default value is in quotes.

This behavior comes from the Cobra library. For example, notice we specify a default but don't actually add that to the description. Cobra automatically appends the (default "pg"):

https://github.com/digitalocean/doctl/blob/062646883a3a9e3c24cce7d1a43a030a089abc4c/commands/databases.go#L88

andrewsomething avatar Oct 21 '24 15:10 andrewsomething

Hi, i would like to work on this issue. Please assign it to me @DO-rrao

naikmubashir avatar Oct 01 '25 14:10 naikmubashir

Kindly assign will check it out ! @DO-rrao

aniketsingh1023 avatar Oct 07 '25 15:10 aniketsingh1023

Hi! I’m interested in working on this issue. Could you please assign it to me? Thank you!

Raj-Dwivedi2005 avatar Oct 08 '25 21:10 Raj-Dwivedi2005