diff mbox

[ndctl,4/9] ndctl, list: allow limiting namespace listing

Message ID 20160627192812.GD20767@omniknight.lm.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Verma, Vishal L June 27, 2016, 7:28 p.m. UTC
On 06/26, Dan Williams wrote:
> In addition to filtering by bus, dimm, and/or region, introduce
> -n/--namespace to limit the listing to the given namespace.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  Documentation/ndctl-list.txt |    6 ++++++
>  ndctl/builtin-list.c         |    6 ++++++
>  util/filter.c                |   21 +++++++++++++++++++++
>  util/filter.h                |    2 ++
>  4 files changed, 35 insertions(+)
> 
This needs a bash completion update as follows (feel free to squash in
or keep separatley..):

From b6d09ff03b7ed16efdc4169aec0442d5c32053bd Mon Sep 17 00:00:00 2001
From: Vishal Verma <vishal.l.verma@intel.com>
Date: Mon, 27 Jun 2016 13:22:58 -0600
Subject: [PATCH] ndctl: bash completion updates for the --namespace= filter

Add completion for the new --namespace= filter.
This will list idle namespaces for completion. It could possibly be made
smarter by checking if a '--idle' or '-i' has been specified on the
command line so far, but maybe that's a bit confusing for the user?

For now, enable the simpler path of listing everything for completion.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 contrib/ndctl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Dan Williams June 27, 2016, 7:38 p.m. UTC | #1
On Mon, Jun 27, 2016 at 12:28 PM, Vishal Verma <vishal.l.verma@intel.com> wrote:
> On 06/26, Dan Williams wrote:
>> In addition to filtering by bus, dimm, and/or region, introduce
>> -n/--namespace to limit the listing to the given namespace.
>>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> ---
>>  Documentation/ndctl-list.txt |    6 ++++++
>>  ndctl/builtin-list.c         |    6 ++++++
>>  util/filter.c                |   21 +++++++++++++++++++++
>>  util/filter.h                |    2 ++
>>  4 files changed, 35 insertions(+)
>>
> This needs a bash completion update as follows (feel free to squash in
> or keep separatley..):
>
> From b6d09ff03b7ed16efdc4169aec0442d5c32053bd Mon Sep 17 00:00:00 2001
> From: Vishal Verma <vishal.l.verma@intel.com>
> Date: Mon, 27 Jun 2016 13:22:58 -0600
> Subject: [PATCH] ndctl: bash completion updates for the --namespace= filter
>
> Add completion for the new --namespace= filter.
> This will list idle namespaces for completion. It could possibly be made
> smarter by checking if a '--idle' or '-i' has been specified on the
> command line so far, but maybe that's a bit confusing for the user?
>
> For now, enable the simpler path of listing everything for completion.
>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>

Thanks! Applied as a standalone patch.
diff mbox

Patch

diff --git a/contrib/ndctl b/contrib/ndctl
index 5a7455f..b7a82fc 100755
--- a/contrib/ndctl
+++ b/contrib/ndctl
@@ -91,7 +91,7 @@  __ndctlcomp()
 
 	COMPREPLY=( $( compgen -W "$1" -- "$2" ) )
 	for cword in "${COMPREPLY[@]}"; do
-		if [[ "$cword" == @(--bus|--region|--type|--mode|--size|--dimm|--reconfig|--uuid|--name|--sector-size|--map) ]]; then
+		if [[ "$cword" == @(--bus|--region|--type|--mode|--size|--dimm|--reconfig|--uuid|--name|--sector-size|--map|--namespace) ]]; then
 			COMPREPLY[$i]="${cword}="
 		else
 			COMPREPLY[$i]="${cword} "
@@ -146,6 +146,9 @@  __ndctl_comp_options()
 		--dimm)
 			opts=$(__ndctl_get_dimms)
 			;;
+		--namespace)
+			opts=$(__ndctl_get_ns -i)
+			;;
 		--reconfig)
 			# It is ok to reconfig disabled namespaces
 			opts=$(__ndctl_get_ns -i)