From patchwork Sat Jan 26 15:16:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 405 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4565960C78 for ; Sat, 26 Jan 2019 16:17:14 +0100 (CET) Received: from pendragon.ideasonboard.com (85-76-41-125-nat.elisa-mobile.fi [85.76.41.125]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4A37923A for ; Sat, 26 Jan 2019 16:17:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1548515833; bh=VEl7LszE+QYJV76VMZ4+ksy270BkuOmpSupr87m03+w=; h=From:To:Subject:Date:From; b=TwVcNfNdiQ9jXHehzLOxMcffYd1pChyywgBLGjHuWb/SuPXT+SYV7iQqzap7bWl0x In4NODVmStqk1POYsS50kZeqbPjw8eXD8zVdC0DqUpMtDMztf5L1ISifa0ythaN2a1 RaT1VFx+BEKAk03kRfLa8DjuhId4l9ysAAyczMAY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 26 Jan 2019 17:16:59 +0200 Message-Id: <20190126151659.7438-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] cam: options: Indent multi-line help message correctly 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: Sat, 26 Jan 2019 15:17:14 -0000 Split multi-line help messages and indent all lines the same way. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/cam/options.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cam/options.cpp b/src/cam/options.cpp index 55c42540f924..83601270207b 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -153,7 +153,17 @@ void OptionsParser::usage() } std::cerr << std::setw(indent) << std::left << argument; - std::cerr << option.help << std::endl; + + for (const char *help = option.help, *end = help; end; ) { + end = strchr(help, '\n'); + if (end) { + std::cerr << std::string(help, end - help + 1); + std::cerr << std::setw(indent) << " "; + help = end + 1; + } else { + std::cerr << help << std::endl; + } + } } }