]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-ls: Update help message to include fields
authorStéphane Graber <stgraber@ubuntu.com>
Fri, 7 Mar 2014 20:01:54 +0000 (15:01 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 7 Mar 2014 22:18:47 +0000 (17:18 -0500)
Instead of maintaining hardcoded lists, point everyone to --help and
have the current list of valid and default fields printed there.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
doc/lxc-ls.sgml.in
src/lxc/lxc-ls.in

index 37e356c476875204df4dda8e375dd8c7b949c931..1c40d33de3b09c06c723eb47e2e8b4f981b5ac36 100644 (file)
@@ -145,8 +145,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
         <listitem>
           <para>
             Comma separate list of column to show in the fancy output.
-            Valid values are: name, state, ipv4, ipv6 and pid
-            Default is: name,state,ipv4,ipv6
+            The list of accepted and default fields is listed in --help.
           </para>
         </listitem>
       </varlistentry>
index 0f81391159388b67ef7b10d3e72fd84ab45f96cf..7e35ab26ecc8ad9e81941b539ec7c126dcf0d376 100755 (executable)
@@ -104,10 +104,16 @@ def get_root_path(path):
 # Constants
 FIELDS = ("name", "state", "ipv4", "ipv6", "autostart", "pid",
           "memory", "ram", "swap")
+DEFAULT_FIELDS = ("name", "state", "ipv4", "ipv6", "autostart")
 
 # Begin parsing the command line
 parser = argparse.ArgumentParser(description=_("LXC: List containers"),
-                                 formatter_class=argparse.RawTextHelpFormatter)
+                                 formatter_class=argparse.RawTextHelpFormatter,
+                                 epilog=_("""Valid fancy-format fields:
+  %s
+
+Default fancy-format fields:
+  %s\n""" % (", ".join(FIELDS), ", ".join(DEFAULT_FIELDS))))
 
 parser.add_argument("-1", dest="one", action="store_true",
                     help=_("list one container per line (default when piped)"))
@@ -132,7 +138,7 @@ parser.add_argument("-f", "--fancy", action="store_true",
                     help=_("use fancy output"))
 
 parser.add_argument("-F", "--fancy-format", type=str,
-                    default="name,state,ipv4,ipv6,autostart",
+                    default=",".join(DEFAULT_FIELDS),
                     help=_("comma separated list of fields to show"))
 
 parser.add_argument("--nesting", dest="nesting", action="store_true",