Skip to content

Commit 7c46f54

Browse files
Documentation WIP
1 parent 8d18658 commit 7c46f54

File tree

1 file changed

+66
-6
lines changed

1 file changed

+66
-6
lines changed

README.md

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,83 @@ The following `rabbitmqadmin` v1 features are not currently implemented:
4141

4242
## Usage
4343

44-
### Getting Help
44+
### Interactive vs. Use in Scripts
45+
46+
Like the original version, `rabbitmqadmin` v2 is first and foremost built for interactive use
47+
by humans. Many commands will output formatted tables, for example:
48+
49+
```shell
50+
rabbitmqadmin show overview
51+
```
52+
53+
will output a table that looks like this:
54+
55+
```
56+
┌──────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────┐
57+
│ Overview │
58+
├──────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┤
59+
│ key │ value │
60+
├──────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┤
61+
│ Product name │ RabbitMQ │
62+
├──────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┤
63+
│ Product version │ 4.0.5 │
64+
├──────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┤
65+
│ RabbitMQ version │ 4.0.5 │
66+
├──────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┤
67+
│ Erlang version │ 26.2.5.6 │
68+
├──────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┤
69+
│ Erlang details │ Erlang/OTP 26 [erts-14.2.5.5] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] │
70+
└──────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────┘
71+
```
72+
73+
As it is easy to observe, parsing such output in a script will be challenging.
74+
75+
For this reason, `rabbitmqadmin` v2 can render results in a way that would be much more friendly
76+
for scripting if the `--non-interactive` flag is passed. It is a global flag so it must be
77+
passed before the command and subcommand name:
78+
79+
```shell
80+
rabbitmqadmin --non-interactive show overview
81+
```
82+
83+
The output of the above command will not include any table borders and will is much easier to parse
84+
as a result:
85+
86+
```
87+
key
88+
Product name RabbitMQ
89+
Product version 4.0.5
90+
RabbitMQ version 4.0.5
91+
Erlang version 26.2.5.6
92+
Erlang details Erlang/OTP 26 [erts-14.2.5.5] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
93+
```
94+
95+
### Exploring the CLI with --help
4596

4697
To learn about what command groups and specific commands are available, run
4798

4899
``` shell
49100
rabbitmqadmin --help
50101
```
51102

52-
Note that in this version, **global flags must precede the command category (e.g. `list`) and the command itself**:
103+
This flag can be appended to a command or subcommand to get command-specific documentation:
53104

54105
```shell
55-
rabbitmqadmin --vhost "events" declare queue --name "target.quorum.queue.name" --type "quorum" --durable true
106+
rabbitmqadmin declare queue --help
107+
# => creates or declares things
108+
# =>
109+
# => Usage: rabbitmqadmin declare [object]
110+
# => ...
56111
```
57112

58-
The same command will display global flags. To learn about a specific command, append
59-
`--help` to it:
113+
And with a specific subcommand:
60114

61-
``` shell
115+
```shell
62116
rabbitmqadmin declare queue --help
117+
# => declares a queue
118+
# =>
119+
# => Usage: rabbitmqadmin declare queue [OPTIONS] --name <name>
120+
# => ...
63121
```
64122

65123
### Retrieving Basic Node Information
@@ -68,6 +126,8 @@ rabbitmqadmin declare queue --help
68126
rabbitmqadmin show overview
69127
```
70128

129+
will display essential node information in tabular form.
130+
71131
### Retrieving Connection, Queue/Stream, Channel Churn Information
72132

73133
Helps assess connection, queue/stream, channel [churn metrics](https://www.rabbitmq.com/docs/connections#high-connection-churn) in the cluster.

0 commit comments

Comments
 (0)