This repository has been archived by the owner on Jul 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
ciao-cli: reduce the output of ciao-cli instance list #308
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fmt.Fprintf(w, "\t%s", server.ID) | ||
fmt.Fprintf(w, "\t%s", server.Status) | ||
fmt.Fprintf(w, "\t%s", server.Addresses.Private[0].Addr) | ||
fmt.Fprintf(w, "\t%s", server.SSHIP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server.SSHIP can be an empty string in which case this is a property that we do not export. Thus I'd like those 2 lines to be handled this way:
if server.SSHIP != "" {
fmt.Fprintf(w, "\t%s", server.SSHIP)
fmt.Fprintf(w, "\t%d", server.SSHPort)
} else {
fmt.Fprintf(w, "\tN/A")
fmt.Fprintf(w, "\tN/A")
}
Besides the |
ciao-cli instance list output shows a detailed information for each instance that is running taking 1 line per property making the output difficult to digest by humans trying to seek fast the instance of interest. For example: Instance #1 UUID: 37089506-dfc4-411c-ae57-c261ef891a7f Status: running Private IP: 172.16.0.3 MAC Address: 02:00:ac:10:00:03 CN UUID: 1d1f0791-eb93-4947-893f-8b325433dea7 Image UUID: 73a86d7e-93c0-480e-9c41-ab42f69b7799 Tenant UUID: effa268c7350464797e2794b798658aa SSH IP: 192.168.10.180 SSH Port: 33003 This commit makes instance list print a table with the most relevant information of each instance as a field, taking 1 line per instance. For Example: # UUID Status Private IP SSH IP SSH PORT 1 37089506-dfc4-411c-ae57-c261ef891a7f running 172.16.0.3 192.168.10.180 33003 2 49e5d95a-1e40-4b3f-988a-183b607817c4 running 172.16.0.2 192.168.10.180 33002 Also adds the instance list -detail option to print the full information for each instance since this output can be consumed by scripts. Signed-off-by: Alberto Murillo <[email protected]>
If anybody has automation around the cli, this will break them. Probably that's not extensively the case currently. Which argues for making this change sooner than later. Looks good to me. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ciao-cli instance list output shows a detailed information for
each instance that is running taking 1 line per property making
the output difficult to digest by humans trying to seek fast the
instance of interest. For example:
This commit makes instance list print a table with the most relevant
information of each instance as a field, taking 1 line per instance.
For Example:
Also adds the instance list -detail option to print the full information
for each instance since this output can be consumed by scripts.
Signed-off-by: Alberto Murillo [email protected]