mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #15494 from jmhbnz/txn_help_docs
Add detailed long description for etcdctl txn
This commit is contained in:
commit
946918e4a1
@ -36,7 +36,30 @@ func NewTxnCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "txn [options]",
|
||||
Short: "Txn processes all the requests in one transaction",
|
||||
Run: txnCommandFunc,
|
||||
Long: `Txn reads multiple etcd requests from standard input and applies them as a single atomic transaction.
|
||||
|
||||
A transaction consists of three components:
|
||||
1) a list of conditions,
|
||||
2) a list of requests to apply if all the conditions are true,
|
||||
3) 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.`,
|
||||
Run: txnCommandFunc,
|
||||
}
|
||||
cmd.Flags().BoolVarP(&txnInteractive, "interactive", "i", false, "Input transaction in interactive mode")
|
||||
return cmd
|
||||
|
Loading…
x
Reference in New Issue
Block a user