[Lxc-users] lxc-ps: support '-n name' and '-- ps-options'

Serge E. Hallyn serge.hallyn at canonical.com
Fri Aug 5 13:49:34 UTC 2011


This is more consistent with other lxc commands

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/820720

Index: ephemeral/src/lxc/lxc-ps.in
===================================================================
--- ephemeral.orig/src/lxc/lxc-ps.in	2011-08-03 22:28:39.854937920 -0500
+++ ephemeral/src/lxc/lxc-ps.in	2011-08-03 22:29:35.995216226 -0500
@@ -131,7 +131,7 @@
 
 sub display_usage {
     print <<EOF;
-Usage: lxc-ps [--help] [--usage] [--name NAME...] [--lxc] [ps options]
+Usage: lxc-ps [--help] [--usage] [-n|--name NAME...] [--lxc] [-- ps options]
 EOF
 }
 
@@ -154,7 +154,7 @@
 EOF
 }
 
-use Getopt::Long qw(:config no_auto_abbrev pass_through);
+use Getopt::Long qw(:config pass_through);
 
 my $arg_help  = '';
 my $arg_usage = '';
@@ -172,6 +172,10 @@
 if ($arg_help)  {display_help; exit 0;}
 if ($arg_usage) {display_usage; exit 0;}
 
+if ($ARGV[0] == '--') {
+	shift @ARGV;
+}
+
 # Should we filter processes related to containers
 if ($arg_lxc) {
 	$LXC_DISPLAY = 1;




More information about the lxc-users mailing list