From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en4y6-0006yi-Pf for guix-patches@gnu.org; Sat, 17 Feb 2018 11:04:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en4y2-00006w-R3 for guix-patches@gnu.org; Sat, 17 Feb 2018 11:04:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:40574) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en4y2-00006s-Lt for guix-patches@gnu.org; Sat, 17 Feb 2018 11:04:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1en4y2-0007UK-57 for guix-patches@gnu.org; Sat, 17 Feb 2018 11:04:02 -0500 Subject: [bug#30495] [PATCH] bash completion: Complete files names after 'guix package -m'. Resent-Message-ID: From: Oleg Pykhalov References: <20180217090738.6812-1-go.wigust@gmail.com> <87wozbtyah.fsf@fastmail.com> Date: Sat, 17 Feb 2018 19:03:11 +0300 In-Reply-To: <87wozbtyah.fsf@fastmail.com> (Marius Bakke's message of "Sat, 17 Feb 2018 16:45:42 +0100") Message-ID: <87wozbtxhc.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Marius Bakke Cc: 30495@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Marius Bakke writes: > Oleg Pykhalov writes: > >> * etc/completion/bash/guix (_guix_is_dash_L): Replace with >> =E2=80=98_guix_is_dash_L_or_m=E2=80=99. >> (_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 >> } >>=20=20 >> -_guix_is_dash_L () >> +_guix_is_dash_L_or_m () >> { >> - [ "${COMP_WORDS[$COMP_CWORD - 1]}" =3D "-L" ] \ >> + comp_words_minus_1=3D"${COMP_WORDS[$COMP_CWORD - 1]}" >> + [ "$comp_words_minus_1" =3D "-L" ] || [ "$comp_words_minus_1" =3D "= -m" ] \ >> || { case "${COMP_WORDS[$COMP_CWORD]}" in >> --load-path=3D*) 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 =E2=80=98--manifest= =3D=E2=80=99. =E2=80=98--load-path=3D=E2=80=99 doesn't have a file completion too. Only = completion for equal sign before. Oleg. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-bash-completion-Complete-files-names-after-guix-pack.patch Content-Transfer-Encoding: quoted-printable Content-Description: [PATCH] bash completion: Complete files names after 'guix package From=20b6d104ec1b3df46a409c989bf12e19c30a920c00 Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov 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=3DUTF-8 Content-Transfer-Encoding: 8bit * etc/completion/bash/guix (_guix_is_dash_L): Replace with =E2=80=98_guix_is_dash_L_or_m=E2=80=99. (_guix_complete): Add this. =2D-- 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 =2D-- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix @@ -106,6 +106,15 @@ _guix_is_dash_L () esac } } =20 +_guix_is_dash_m () +{ + [ "${COMP_WORDS[$COMP_CWORD - 1]}" =3D "-m" ] \ + || { case "${COMP_WORDS[$COMP_CWORD]}" in + --manifest=3D*) true;; + *) false;; + esac } +} + _guix_complete_file () { # Let Readline complete file names. @@ -149,7 +158,7 @@ _guix_complete () *) if _guix_is_command "package" then =2D if _guix_is_dash_L + if _guix_is_dash_L || _guix_is_dash_m then _guix_complete_file elif _guix_is_removing =2D-=20 2.16.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEc+OyAXw1EaDPCmAPckbhHGm3lWkFAlqIUj8ACgkQckbhHGm3 lWnMbA//VwzjT2kxffXRVj9hJRwn/SStEi/lCKzzj2pIbQ8u2ZdvtY+kcz9NpiM+ 0u2q4EAzln9Nak3RU9wW8Fw+rVph6r8/xsFPJUMl2yBhayMX8XsPFLakOdPSs5P4 qbYv4jTBaWguggxDtEauoq7esNS4URn87zXpdCLL9hkUEXaz6mlMlB1hskLtvQ3M v+zo8J4PZygLIomxumkX4NGDzQYL/UbQcKrqod7iTYNfQoGGDi8Fpjxl4fZfbFzO 6ZR3gjQ4dbeaH+s28klACZywPyO3n5kq5SMVwT0sXRHn67PMRq/WMifZfWPVeKMh tMMfybnI2kFGm1jD4Y/UL+gLJYM7lT3YHSSD6xF9xWYKimtdB/BW7lpniJC6pmeS 27IgTMz59oOZtqobu3G8tXLm/FniO2B7ZZrQIRx9XdtkHTZQPusWSCvBLIrDmm1R sb+1z7TD71o4CG5Os3U/7E10PJK5xGkjTEq+M2MiYI+BYRwMA8JX+1z2un2EcJxl MbeW9LkjBzt0U7FT1WqsngDwUMaIc3SJKYuLLsGPQcM8KpJLKwJ3DOaICrpN/tOH LC4BQq3W7NFQI3ORA5msnlqMG7ltF6MhiL7cq7zIvtbVEpjiqnMq3zrxdYeAQaLO v5zH9V1rf4rzjZjaQ6xZSf3LeavV6ldcKqqy3gW0NcAdFvJA3Ss= =CFvQ -----END PGP SIGNATURE----- --==-=-=--