Skip to content

One line per item in non-interactive output #53

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

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

mkuratczyk
Copy link
Collaborator

Before - multiple lines and a space as the first character of the row/line:

$ rabbitmqadmin --non-interactive list queues
 qq  /  quorum  true  false  false  x-queue-type: "quorum"  rabbit-1@K6L59PF0JR  running  rabbit-1@K6L59PF0JR  rabbit-1@K6L59PF0JR  rabbit-1@K6L59PF0JR  26844  0  0    0  0  0 
                                                                                                               rabbit-2@K6L59PF0JR  rabbit-2@K6L59PF0JR                         
                                                                                                               rabbit-3@K6L59PF0JR  rabbit-3@K6L59PF0JR          

With this PR:

qq / quorum true false false x-queue-type: "quorum", rabbit-1@K6L59PF0JR running rabbit-1@K6L59PF0JR rabbit-1@K6L59PF0JR,rabbit-2@K6L59PF0JR,rabbit-3@K6L59PF0JR rabbit-1@K6L59PF0JR,rabbit-2@K6L59PF0JR,rabbit-3@K6L59PF0JR 29860 0 0  0 0 0

This enables common shell scripting techniques, eg:

$ rabbitmqadmin --non-interactive list queues | cut -w -f 1
qq1
qq2
qq3

Additionally, don't put the space at the beginning of the line
@michaelklishin michaelklishin merged commit 93bcf37 into main Mar 10, 2025
12 checks passed
@michaelklishin
Copy link
Collaborator

Good find. It will apply to all multi-line values, so lets see how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants