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

Command syntax: Capitalize tokens #116

Open
zuiderkwast opened this issue Aug 31, 2024 · 0 comments
Open

Command syntax: Capitalize tokens #116

zuiderkwast opened this issue Aug 31, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@zuiderkwast
Copy link
Contributor

For clarity, I suggest that fixed tokens are capitalized in command syntax. This makes all fixed content of a command syntax render as capitalized (command name and tokens) and variable content as lowercase (key names, values, etc.).

For example, the type tokens of CLIENT LIST.

Current rendering:

CLIENT LIST [ TYPE normal | master | replica | pubsub ] [ ID client-id ] [ [ ID client-id ] ... ] 

Expected rendering of the TYPE argument (with normal, master, replica, pubsub capitalized):

[ TYPE <NORMAL | MASTER | REPLICA | PUBSUB> ]

Bonus: In this example, it would help to display the < and > around the arguments after the TYPE token, to disambiguate the syntax. Otherwise, [ TYPE NORMAL | MASTER | REPLICA | PUBSUB ] can be interpreted as TYPE NORMAL or MASTER or REPLICA or PUBSUB, i.e. as if the word "TYPE" is only included in TYPE NORMAL but not in the others.

(This is how it's rendered on Redis website and our man pages btw.)

Details

The TYPE argument in CLIENT LIST has the JSON definition below.

Not that it is "optional" ([...] around the whole arguemnt) and has type "oneof" (<...> around the things that follow after TYPE).

            {
                "token": "TYPE",
                "name": "client-type",
                "type": "oneof",
                "optional": true,
                "since": "5.0.0",
                "arguments": [
                    {
                        "name": "normal",
                        "type": "pure-token",
                        "token": "normal"
                    },
                    {
                        "name": "master",
                        "type": "pure-token",
                        "token": "master"
                    },
                    {
                        "name": "replica",
                        "type": "pure-token",
                        "token": "replica"
                    },
                    {
                        "name": "pubsub",
                        "type": "pure-token",
                        "token": "pubsub"
                    }
                ]
            },
@zuiderkwast zuiderkwast added the enhancement New feature or request label Aug 31, 2024
madolson pushed a commit that referenced this issue Jan 7, 2025
In the command page's "Usage:", the lower case `name` was used in case
of a `pure-token`. However, the all caps `token` should be used instead.
For MIGRATE, this makes an even bigger difference (see `empty-string`):

Before:

```
Usage:
    MIGRATE host port 〈 key | empty-string 〉 destination-db timeout [ copy ] [ replace ] [ AUTH auth | AUTH2 username password ] [ KEYS keys ] [ [ KEYS keys ] ... ]
```

Now:

```
Usage:
    MIGRATE host port 〈 key | "" 〉 destination-db timeout [ COPY ] [ REPLACE ] [ AUTH auth | AUTH2 username password ] [ KEYS keys ] [ [ KEYS keys ] ... ]
```

This addresses a part of #116

By submitting this pull request, I confirm that my contribution is made
under the terms of the BSD-3-Clause License.

Signed-off-by: Simon Baatz <[email protected]>
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