--- /dev/null
+Return-Path: <wking@tremily.us>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 19EE1431FC0\r
+ for <notmuch@notmuchmail.org>; Fri, 3 Oct 2014 11:21:15 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.1\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id YE-tOzpSDU84 for <notmuch@notmuchmail.org>;\r
+ Fri, 3 Oct 2014 11:21:07 -0700 (PDT)\r
+Received: from resqmta-po-07v.sys.comcast.net (resqmta-po-07v.sys.comcast.net\r
+ [96.114.154.166])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id BBFB8431FB6\r
+ for <notmuch@notmuchmail.org>; Fri, 3 Oct 2014 11:21:07 -0700 (PDT)\r
+Received: from resomta-po-19v.sys.comcast.net ([96.114.154.243])\r
+ by resqmta-po-07v.sys.comcast.net with comcast\r
+ id yiLt1o0055FMDhs01iM7D0; Fri, 03 Oct 2014 18:21:07 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+ by resomta-po-19v.sys.comcast.net with comcast\r
+ id yiM51o00E152l3L01iM517; Fri, 03 Oct 2014 18:21:06 +0000\r
+Received: by odin.tremily.us (Postfix, from userid 1000)\r
+ id 2699413EA33C; Fri, 3 Oct 2014 11:21:05 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin;\r
+ t=1412360465; bh=YDCxxJ0z1/HH/7VyFCX5nYITv+PceEvVcAIWv6EhQYI=;\r
+ h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To:\r
+ References;\r
+ b=kY3LsZURnKTY2cLjcboWsEE8BScVKgNgYPsAdI6ElwaiOjhZC9wwBS+PYk4cRLj5T\r
+ Mxt2OY2d5NJ0aMkbtXJVz7vIuBYR0Kk4uXy59SKVZfHUUqL8LTQQt9jnK5fpM1oRjW\r
+ ndNg+JAWaiY2EaNBrwHDW3UwKooSHIt3PPqqjSZo=\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v6 2/2] nmbug: Add a 'help' command for folks who don't like\r
+ --help\r
+Date: Fri, 3 Oct 2014 11:20:58 -0700\r
+Message-Id:\r
+ <0a4f023f734b5c59ff3b3577961f679d141c3c74.1412359989.git.wking@tremily.us>\r
+X-Mailer: git-send-email 2.0.4\r
+In-Reply-To: <cover.1412359989.git.wking@tremily.us>\r
+References: <cover.1412359989.git.wking@tremily.us>\r
+In-Reply-To: <cover.1412359989.git.wking@tremily.us>\r
+References: <cover.1412359989.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+ s=q20140121; t=1412360467;\r
+ bh=8rEqzVyY3jed6cjDeAUf2BedGIrbtJReNs8jlFb+B2E=;\r
+ h=Received:Received:Received:From:To:Subject:Date:Message-Id;\r
+ b=VUR9gWN6VH6BZ85N7dYxe+ZLD5MZAhn1rPlkHC0F9l+qVWIvZC3WUWfPuXS7fHepd\r
+ qHXgzi7V2Vb2sADFNKGrtTzGDvOZrxxlPUjukqGQtJLKSGcJHaGWEu+JN3hpqhD92L\r
+ mKx5Gp8lcVscGhxaRyzRpqcc4UP/ruNaUXxzbRxHOZWRrW+wQTMc4FM3UvU/23Cdrf\r
+ RxzaHiuI4hNLp8Toh+iYkUXlIpnIfyKHXDLvzgs9CVGEKLB1NJJF2jSqwPemarmj/n\r
+ yTw7ue1sBiRt+beQtiU9N2qA+oxDlvZEB9YV5VTlkrNmBo/Rb8g7QQAcWOKHyz91Vv\r
+ zVeBjuwWcw5PA==\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>, David Bremner <bremner@debian.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 03 Oct 2014 18:21:15 -0000\r
+\r
+The 'if args.func == help' block at the end avoids:\r
+\r
+ AttributeError: 'functools.partial' object has no attribute '__code__'\r
+---\r
+ devel/nmbug/nmbug | 31 ++++++++++++++++++++++++++++++-\r
+ 1 file changed, 30 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug\r
+index 9402ead..932ec12 100755\r
+--- a/devel/nmbug/nmbug\r
++++ b/devel/nmbug/nmbug\r
+@@ -32,6 +32,7 @@ from __future__ import unicode_literals\r
+ \r
+ import codecs as _codecs\r
+ import collections as _collections\r
++import functools as _functools\r
+ import inspect as _inspect\r
+ import locale as _locale\r
+ import logging as _logging\r
+@@ -677,6 +678,24 @@ def _unpack_diff_lines(stream):\r
+ yield (id, tag)\r
+ \r
+ \r
++def _help(parser, command=None):\r
++ """\r
++ Show help for an nmbug command.\r
++\r
++ Because some folks prefer:\r
++\r
++ $ nmbug help COMMAND\r
++\r
++ to\r
++\r
++ $ nmbug COMMAND --help\r
++ """\r
++ if command:\r
++ parser.parse_args([command, '--help'])\r
++ else:\r
++ parser.parse_args(['--help'])\r
++\r
++\r
+ if __name__ == '__main__':\r
+ import argparse\r
+ \r
+@@ -692,6 +711,8 @@ if __name__ == '__main__':\r
+ help='Log verbosity. Defaults to {!r}.'.format(\r
+ _logging.getLevelName(_LOG.level).lower()))\r
+ \r
++ help = _functools.partial(_help, parser=parser)\r
++ help.__doc__ = _help.__doc__\r
+ subparsers = parser.add_subparsers(\r
+ title='commands',\r
+ description=(\r
+@@ -703,6 +724,7 @@ if __name__ == '__main__':\r
+ 'clone',\r
+ 'commit',\r
+ 'fetch',\r
++ 'help',\r
+ 'log',\r
+ 'merge',\r
+ 'pull',\r
+@@ -746,6 +768,10 @@ if __name__ == '__main__':\r
+ 'Override the default configured in branch.<name>.remote '\r
+ 'to fetch from a particular remote repository (e.g. '\r
+ "'origin')."))\r
++ elif command == 'help':\r
++ subparser.add_argument(\r
++ 'command', metavar='COMMAND', nargs='?',\r
++ help='The command to show help for.')\r
+ elif command == 'log':\r
+ subparser.add_argument(\r
+ 'args', metavar='ARG', nargs='*',\r
+@@ -796,7 +822,10 @@ if __name__ == '__main__':\r
+ parser.print_usage()\r
+ _sys.exit(1)\r
+ \r
+- (arg_names, varargs, varkw) = _inspect.getargs(args.func.__code__)\r
++ if args.func == help:\r
++ arg_names = ['command']\r
++ else:\r
++ (arg_names, varargs, varkw) = _inspect.getargs(args.func.__code__)\r
+ kwargs = {key: getattr(args, key) for key in arg_names if key in args}\r
+ try:\r
+ args.func(**kwargs)\r
+-- \r
+2.1.0.60.g85f0837\r
+\r