unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#30495] [PATCH] bash completion: Complete files names after 'guix package -m'.
@ 2018-02-17  9:07 Oleg Pykhalov
  2018-02-17 15:45 ` Marius Bakke
  0 siblings, 1 reply; 5+ messages in thread
From: Oleg Pykhalov @ 2018-02-17  9:07 UTC (permalink / raw)
  To: 30495

* etc/completion/bash/guix (_guix_is_dash_L): Replace with
‘_guix_is_dash_L_or_m’.
(_guix_complete): Add this.
---
 etc/completion/bash/guix | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index 6b84193db..286c4f1c5 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -97,9 +97,10 @@ _guix_is_removing ()
     $result
 }
 
-_guix_is_dash_L ()
+_guix_is_dash_L_or_m ()
 {
-    [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-L" ] \
+    comp_words_minus_1="${COMP_WORDS[$COMP_CWORD - 1]}"
+    [ "$comp_words_minus_1" = "-L" ] || [ "$comp_words_minus_1" = "-m" ] \
 	|| { case "${COMP_WORDS[$COMP_CWORD]}" in
 		 --load-path=*) true;;
 		 *)             false;;
@@ -149,7 +150,7 @@ _guix_complete ()
 	*)
 	    if _guix_is_command "package"
 	    then
-		if _guix_is_dash_L
+		if _guix_is_dash_L_or_m
 		then
 		    _guix_complete_file
 		elif _guix_is_removing
-- 
2.16.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#30495] [PATCH] bash completion: Complete files names after 'guix package -m'.
  2018-02-17  9:07 [bug#30495] [PATCH] bash completion: Complete files names after 'guix package -m' Oleg Pykhalov
@ 2018-02-17 15:45 ` Marius Bakke
  2018-02-17 16:03   ` Oleg Pykhalov
  0 siblings, 1 reply; 5+ messages in thread
From: Marius Bakke @ 2018-02-17 15:45 UTC (permalink / raw)
  To: Oleg Pykhalov, 30495

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

Oleg Pykhalov <go.wigust@gmail.com> writes:

> * etc/completion/bash/guix (_guix_is_dash_L): Replace with
> ‘_guix_is_dash_L_or_m’.
> (_guix_complete): Add this.

[...]

> diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
> index 6b84193db..286c4f1c5 100644
> --- a/etc/completion/bash/guix
> +++ b/etc/completion/bash/guix
> @@ -97,9 +97,10 @@ _guix_is_removing ()
>      $result
>  }
>  
> -_guix_is_dash_L ()
> +_guix_is_dash_L_or_m ()
>  {
> -    [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-L" ] \
> +    comp_words_minus_1="${COMP_WORDS[$COMP_CWORD - 1]}"
> +    [ "$comp_words_minus_1" = "-L" ] || [ "$comp_words_minus_1" = "-m" ] \
>  	|| { case "${COMP_WORDS[$COMP_CWORD]}" in
>  		 --load-path=*) true;;
>  		 *)             false;;

I think this fails to account for the long form "--manifest".  Perhaps
it's better to add a new "_guix_is_dash_m" and use

"if _guix_is_dash_L || _guix_is_dash_m"

below.  WDYT?

> @@ -149,7 +150,7 @@ _guix_complete ()
>  	*)
>  	    if _guix_is_command "package"
>  	    then
> -		if _guix_is_dash_L
> +		if _guix_is_dash_L_or_m
>  		then
>  		    _guix_complete_file
>  		elif _guix_is_removing
> -- 
> 2.16.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#30495] [PATCH] bash completion: Complete files names after 'guix package -m'.
  2018-02-17 15:45 ` Marius Bakke
@ 2018-02-17 16:03   ` Oleg Pykhalov
  2018-02-17 16:14     ` Marius Bakke
  0 siblings, 1 reply; 5+ messages in thread
From: Oleg Pykhalov @ 2018-02-17 16:03 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 30495


[-- Attachment #1.1: Type: text/plain, Size: 1261 bytes --]

Marius Bakke <mbakke@fastmail.com> writes:

> Oleg Pykhalov <go.wigust@gmail.com> writes:
>
>> * etc/completion/bash/guix (_guix_is_dash_L): Replace with
>> ‘_guix_is_dash_L_or_m’.
>> (_guix_complete): Add this.
>
> [...]
>
>> diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
>> index 6b84193db..286c4f1c5 100644
>> --- a/etc/completion/bash/guix
>> +++ b/etc/completion/bash/guix
>> @@ -97,9 +97,10 @@ _guix_is_removing ()
>>      $result
>>  }
>>  
>> -_guix_is_dash_L ()
>> +_guix_is_dash_L_or_m ()
>>  {
>> -    [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-L" ] \
>> +    comp_words_minus_1="${COMP_WORDS[$COMP_CWORD - 1]}"
>> +    [ "$comp_words_minus_1" = "-L" ] || [ "$comp_words_minus_1" = "-m" ] \
>>  	|| { case "${COMP_WORDS[$COMP_CWORD]}" in
>>  		 --load-path=*) true;;
>>  		 *)             false;;
>
> I think this fails to account for the long form "--manifest".  Perhaps
> it's better to add a new "_guix_is_dash_m" and use
>
> "if _guix_is_dash_L || _guix_is_dash_m"
>
> below.  WDYT?

Nice catch!  Thanks.

But I don't know how to implement a file completion for ‘--manifest=’.
‘--load-path=’ doesn't have a file completion too.  Only completion for
equal sign before.

Oleg.


[-- Attachment #1.2: [PATCH] bash completion: Complete files names after 'guix package --]
[-- Type: text/x-patch, Size: 1285 bytes --]

From b6d104ec1b3df46a409c989bf12e19c30a920c00 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Sat, 17 Feb 2018 12:05:26 +0300
Subject: [PATCH] bash completion: Complete files names after 'guix package
 -m'.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* etc/completion/bash/guix (_guix_is_dash_L): Replace with
‘_guix_is_dash_L_or_m’.
(_guix_complete): Add this.
---
 etc/completion/bash/guix | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index 6b84193db..70430c5c9 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -106,6 +106,15 @@ _guix_is_dash_L ()
 	     esac }
 }
 
+_guix_is_dash_m ()
+{
+    [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-m" ] \
+	|| { case "${COMP_WORDS[$COMP_CWORD]}" in
+		 --manifest=*) true;;
+		 *)            false;;
+	     esac }
+}
+
 _guix_complete_file ()
 {
     # Let Readline complete file names.
@@ -149,7 +158,7 @@ _guix_complete ()
 	*)
 	    if _guix_is_command "package"
 	    then
-		if _guix_is_dash_L
+		if _guix_is_dash_L || _guix_is_dash_m
 		then
 		    _guix_complete_file
 		elif _guix_is_removing
-- 
2.16.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#30495] [PATCH] bash completion: Complete files names after 'guix package -m'.
  2018-02-17 16:03   ` Oleg Pykhalov
@ 2018-02-17 16:14     ` Marius Bakke
  2018-02-17 19:25       ` bug#30495: " Oleg Pykhalov
  0 siblings, 1 reply; 5+ messages in thread
From: Marius Bakke @ 2018-02-17 16:14 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 30495

[-- Attachment #1: Type: text/plain, Size: 1465 bytes --]

Oleg Pykhalov <go.wigust@gmail.com> writes:

> Marius Bakke <mbakke@fastmail.com> writes:
>
>> Oleg Pykhalov <go.wigust@gmail.com> writes:
>>
>>> * etc/completion/bash/guix (_guix_is_dash_L): Replace with
>>> ‘_guix_is_dash_L_or_m’.
>>> (_guix_complete): Add this.
>>
>> [...]
>>
>>> diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
>>> index 6b84193db..286c4f1c5 100644
>>> --- a/etc/completion/bash/guix
>>> +++ b/etc/completion/bash/guix
>>> @@ -97,9 +97,10 @@ _guix_is_removing ()
>>>      $result
>>>  }
>>>  
>>> -_guix_is_dash_L ()
>>> +_guix_is_dash_L_or_m ()
>>>  {
>>> -    [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-L" ] \
>>> +    comp_words_minus_1="${COMP_WORDS[$COMP_CWORD - 1]}"
>>> +    [ "$comp_words_minus_1" = "-L" ] || [ "$comp_words_minus_1" = "-m" ] \
>>>  	|| { case "${COMP_WORDS[$COMP_CWORD]}" in
>>>  		 --load-path=*) true;;
>>>  		 *)             false;;
>>
>> I think this fails to account for the long form "--manifest".  Perhaps
>> it's better to add a new "_guix_is_dash_m" and use
>>
>> "if _guix_is_dash_L || _guix_is_dash_m"
>>
>> below.  WDYT?
>
> Nice catch!  Thanks.
>
> But I don't know how to implement a file completion for ‘--manifest=’.
> ‘--load-path=’ doesn't have a file completion too.  Only completion for
> equal sign before.

Oh, OK.  That's another issue I guess.  The patch below LGTM, but the
commit message needs adjusting ;-)

Thank you!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30495: [PATCH] bash completion: Complete files names after 'guix package -m'.
  2018-02-17 16:14     ` Marius Bakke
@ 2018-02-17 19:25       ` Oleg Pykhalov
  0 siblings, 0 replies; 5+ messages in thread
From: Oleg Pykhalov @ 2018-02-17 19:25 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 30495, 30495-done

[-- Attachment #1: Type: text/plain, Size: 1681 bytes --]

Marius Bakke <mbakke@fastmail.com> writes:

> Oleg Pykhalov <go.wigust@gmail.com> writes:
>
>> Marius Bakke <mbakke@fastmail.com> writes:
>>
>>> Oleg Pykhalov <go.wigust@gmail.com> writes:
>>>
>>>> * etc/completion/bash/guix (_guix_is_dash_L): Replace with
>>>> ‘_guix_is_dash_L_or_m’.
>>>> (_guix_complete): Add this.
>>>
>>> [...]
>>>
>>>> diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
>>>> index 6b84193db..286c4f1c5 100644
>>>> --- a/etc/completion/bash/guix
>>>> +++ b/etc/completion/bash/guix
>>>> @@ -97,9 +97,10 @@ _guix_is_removing ()
>>>>      $result
>>>>  }
>>>>  
>>>> -_guix_is_dash_L ()
>>>> +_guix_is_dash_L_or_m ()
>>>>  {
>>>> -    [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-L" ] \
>>>> +    comp_words_minus_1="${COMP_WORDS[$COMP_CWORD - 1]}"
>>>> +    [ "$comp_words_minus_1" = "-L" ] || [ "$comp_words_minus_1" = "-m" ] \
>>>>  	|| { case "${COMP_WORDS[$COMP_CWORD]}" in
>>>>  		 --load-path=*) true;;
>>>>  		 *)             false;;
>>>
>>> I think this fails to account for the long form "--manifest".  Perhaps
>>> it's better to add a new "_guix_is_dash_m" and use
>>>
>>> "if _guix_is_dash_L || _guix_is_dash_m"
>>>
>>> below.  WDYT?
>>
>> Nice catch!  Thanks.
>>
>> But I don't know how to implement a file completion for ‘--manifest=’.
>> ‘--load-path=’ doesn't have a file completion too.  Only completion for
>> equal sign before.
>
> Oh, OK.  That's another issue I guess.  The patch below LGTM, but the
> commit message needs adjusting ;-)

Ouch, thank you for reminding.

Pushed as f5f916792c7069a22d95c5b7c68bcf3bbb86e451

I'll close the bug report.

Thanks,
Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-17 19:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-17  9:07 [bug#30495] [PATCH] bash completion: Complete files names after 'guix package -m' Oleg Pykhalov
2018-02-17 15:45 ` Marius Bakke
2018-02-17 16:03   ` Oleg Pykhalov
2018-02-17 16:14     ` Marius Bakke
2018-02-17 19:25       ` bug#30495: " Oleg Pykhalov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).