From patchwork Sun Jul 17 22:22:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Currey X-Patchwork-Id: 649287 X-Patchwork-Delegate: andrew.donnellan@au1.ibm.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rt16D33SCz9s3s for ; Mon, 18 Jul 2016 08:23:16 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3rt16D2RP4zDqLy for ; Mon, 18 Jul 2016 08:23:16 +1000 (AEST) X-Original-To: snowpatch@lists.ozlabs.org Delivered-To: snowpatch@lists.ozlabs.org Received: from russell.cc (russell.cc [43.229.61.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3rt1673P4mzDqLv for ; Mon, 18 Jul 2016 08:23:11 +1000 (AEST) Received: from snap.lan (124-171-160-237.dyn.iinet.net.au [124.171.160.237]) by russell.cc (OpenSMTPD) with ESMTPSA id 029748d9 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO; Sun, 17 Jul 2016 22:23:14 +0000 (UTC) From: Russell Currey To: snowpatch@lists.ozlabs.org Date: Mon, 18 Jul 2016 08:22:55 +1000 Message-Id: <20160717222255.20803-1-ruscur@russell.cc> X-Mailer: git-send-email 2.9.0 Subject: [snowpatch] [PATCH] args: Fix (-v | --version) X-BeenThere: snowpatch@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Continuous Integration for patch-based workflows List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Russell Currey MIME-Version: 1.0 Errors-To: snowpatch-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "snowpatch" I thought we got this by default with docopt but that's not true. There is a helper in docopt, though, which is nice. Signed-off-by: Russell Currey --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 9bb2064..1476f75 100644 --- a/src/main.rs +++ b/src/main.rs @@ -246,7 +246,7 @@ fn main() { log_builder.init().unwrap(); let args: Args = Docopt::new(USAGE) - .and_then(|d| d.decode()) + .and_then(|d| d.version(env::var("CARGO_PKG_VERSION").ok()).decode()) .unwrap_or_else(|e| e.exit()); let settings = settings::parse(args.arg_config_file);