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

Add detailed long description for etcdctl txn #15494

Merged
merged 1 commit into from
Mar 18, 2023
Merged

Conversation

jmhbnz
Copy link
Member

@jmhbnz jmhbnz commented Mar 16, 2023

etcdctl txn --help is currently not sufficient to be able to use the command without referring to other sources.

We can add a Long: description to at least explain what the stdin payload should contain and provide an example of interactive use.

Here is a preview of the proposed help output:

 james  ~  Documents  etcd   txn_help_docs                                                                                                                   11:32:18 
 ➜ ./bin/etcdctl txn --help
NAME:
        txn - Txn processes all the requests in one transaction

USAGE:
        etcdctl txn [options] [flags]

DESCRIPTION:
        TXN reads multiple etcd requests from standard input and applies them as a single atomic transaction.

        A transaction consists of:
        1) a list of conditions,
        2) a list of requests to apply if all the conditions are true,
        3) and a list of requests to apply if any condition is false.

        Example interactive stdin usage:

        ---
        etcdctl txn -i
        # compares:
        mod("key1") > "0"

        # success requests (get, put, delete):
        put key1 "overwrote-key1"

        # failure requests (get, put, delete):
        put key1 "created-key1"
        put key2 "some extra key"
        ---

        Refer to https://github.com/etcd-io/etcd/blob/main/etcdctl/README.md#txn-options.

OPTIONS:
  -h, --help[=false]            help for txn
  -i, --interactive[=false]     Input transaction in interactive mode

GLOBAL OPTIONS:

Fixes #15441

Include an example stdin usage and a link for full docs.

Signed-off-by: James Blair <mail@jamesblair.net>
Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

cc @ptabor @serathius @spzala

@ahrtr ahrtr merged commit 946918e into etcd-io:main Mar 18, 2023
@jmhbnz jmhbnz deleted the txn_help_docs branch July 16, 2023 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants