From patchwork Thu Jan 24 23:23:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 373 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D79460C82 for ; Fri, 25 Jan 2019 00:23:18 +0100 (CET) X-Halon-ID: 02807be4-202f-11e9-9adf-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 02807be4-202f-11e9-9adf-005056917a89; Fri, 25 Jan 2019 00:23:12 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 25 Jan 2019 00:23:11 +0100 Message-Id: <20190124232311.29636-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] cam: options: optional arguments needs to be specified as --foo=bar X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2019 23:23:18 -0000 It's not state in the documentation but optional arguments needs to be specified using as '--foo=bar' instead of '--foo bar', otherwise the value is not propagated to optarg during argument parsing. Update the usage printing helper to reflect this requirement. Signed-off-by: Niklas Söderlund --- src/cam/options.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cam/options.cpp b/src/cam/options.cpp index 82acff9bbeea476d..73d81d0bc0ec6d38 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -143,7 +143,8 @@ void OptionsParser::usage() }; if (option.argument != ArgumentNone) { - argument += std::string(" "); + argument += option.argument == ArgumentOptional ? + "=" : " "; if (option.argument == ArgumentOptional) argument += "["; argument += option.argumentName;