From 300ca0186a20beb57ea7c4ca321be09bba42fb87 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 11 Dec 2016 12:48:02 +0100 Subject: Adding XML export format to container list command. Signed-off-by: Daniel Baumann --- lib/container/list | 33 +++++++++++++++++++++++++++++++++ share/bash-completion/container | 2 +- share/man/container-list.1.txt | 5 ++++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/lib/container/list b/lib/container/list index 2be55b5..3073853 100755 --- a/lib/container/list +++ b/lib/container/list @@ -171,6 +171,17 @@ cat << EOF EOF ;; + + xml) + +cat << EOF + + ${CONTAINER} + ${ADDRESS} + +EOF + + ;; esac } @@ -278,6 +289,20 @@ host: name: ${HOST} container: +EOF + + ;; + + xml) + +cat << EOF + + ${VERSION} + + + ${HOST} + + EOF ;; @@ -366,6 +391,14 @@ EOF cat << EOF ], } +EOF + + ;; + + xml) + +cat << EOF + EOF ;; diff --git a/share/bash-completion/container b/share/bash-completion/container index 523bc08..8d54ba4 100644 --- a/share/bash-completion/container +++ b/share/bash-completion/container @@ -139,7 +139,7 @@ _container() ;; -f|--format) - opts="cli csv json nwdiag shell yaml" + opts="cli csv json nwdiag shell yaml xml" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; diff --git a/share/man/container-list.1.txt b/share/man/container-list.1.txt index 962d782..d964c4e 100644 --- a/share/man/container-list.1.txt +++ b/share/man/container-list.1.txt @@ -50,7 +50,7 @@ The following container options are available, defaults to *--started --stopped* Specify custom CSV separator, defaults to ','. *-f, --format='FORMAT'*:: - Use format to list container. Currently available formats are 'cli' (default), 'csv', 'json', 'nwdiag', 'shell', or 'yaml'. + Use format to list container. Currently available formats are 'cli' (default), 'csv', 'json', 'nwdiag', 'shell', 'yaml', or 'xml'. *-h, --host='HOSTNAME'*:: List only container that are enabled for automatic start on the specified hostname. Defaults to list containers of the local system only. Using 'all' shows all container regardless of any automatic start configuration. @@ -96,6 +96,9 @@ EXAMPLES *Create a YAML export of all started and stopped containers:*:: sudo container list -f yaml +*Create a XML export of all started and stopped containers:*:: + sudo container list -f xml + SEE ALSO -------- -- cgit v1.2.3