From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hartmut Goebel Subject: bug#27820: guix package -u: order of argument is significant Date: Wed, 26 Jul 2017 10:28:01 +0200 Message-ID: <59785291.80904@crazy-compilers.com> References: <5977294D.1020304@crazy-compilers.com> <87fudkb8zm.fsf@netris.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daHgo-0007ln-1t for bug-guix@gnu.org; Wed, 26 Jul 2017 04:29:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daHgk-0005Wg-OM for bug-guix@gnu.org; Wed, 26 Jul 2017 04:29:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:54033) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1daHgk-0005Vv-L3 for bug-guix@gnu.org; Wed, 26 Jul 2017 04:29:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1daHgk-0006ee-Cd for bug-guix@gnu.org; Wed, 26 Jul 2017 04:29:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87fudkb8zm.fsf@netris.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Mark H Weaver Cc: 27820@debbugs.gnu.org Am 25.07.2017 um 21:40 schrieb Mark H Weaver: > That's because "--fallback" was treated as the argument to -u, i.e. the= > regexp specifying which packages to upgrade. The few compiled packages= > were needed to run the profile hooks. I'm astound about this. Python's argparse library is handling this as the user expects: import argparse parser =3D argparse.ArgumentParser() parser.add_argument('-u', '--update', nargs=3D'?', const=3D42) parser.add_argument('--fallback', action=3D"store_true") print(parser.parse_args(['-u', '--fallback'])) print(parser.parse_args(['-u', 'xxx', '--fallback'])) prints Namespace(fallback=3DTrue, update=3DNone) Namespace(fallback=3DTrue, update=3D'xxx') See https://docs.python.org/3/library/argparse.html#nargs Isn't there a elaborated scheme/guile argparse library we can you? This would/shouls/could also solve the issue that in guix we can not shortcut options. --=20 Regards Hartmut Goebel | Hartmut Goebel | h.goebel@crazy-compilers.com | | www.crazy-compilers.com | compilers which you thought are impossible |