public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH setup 1/9] Allow options which only have long names
Date: Tue, 06 Jun 2017 11:55:00 -0000	[thread overview]
Message-ID: <20170606115432.105020-2-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20170606115432.105020-1-jon.turney@dronecode.org.uk>

We're kind of running out of letters for short options :)
---
 libgetopt++/include/getopt++/DefaultFormatter.h | 7 +++++--
 main.cc                                         | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libgetopt++/include/getopt++/DefaultFormatter.h b/libgetopt++/include/getopt++/DefaultFormatter.h
index 38287f1..440eb54 100644
--- a/libgetopt++/include/getopt++/DefaultFormatter.h
+++ b/libgetopt++/include/getopt++/DefaultFormatter.h
@@ -45,8 +45,11 @@ class DefaultFormatter {
         theStream(aStream)
     {}
     void operator () (Option *anOption) {
-      theStream << s_lead << anOption->shortOption ()[0]
-		<< l_lead << anOption->longOption ()
+      if (anOption->shortOption ()[0] == '\0')
+        theStream << "   ";
+      else
+        theStream << s_lead << anOption->shortOption ()[0];
+      theStream << l_lead << anOption->longOption ()
 		<< std::string (o_len
 				- s_lead.size () - 1 - l_lead.size ()
 				- anOption->longOption ().size (), ' ');
diff --git a/main.cc b/main.cc
index fe1d6c1..b44f9b6 100644
--- a/main.cc
+++ b/main.cc
@@ -94,7 +94,7 @@ static BoolOption NoAdminOption (false, 'B', "no-admin", "Do not check for and e
 static BoolOption WaitOption (false, 'W', "wait", "When elevating, wait for elevated child process");
 static BoolOption HelpOption (false, 'h', "help", "print help");
 static StringOption SetupBaseNameOpt ("setup", 'i', "ini-basename", "Use a different basename, e.g. \"foo\", instead of \"setup\"", false);
-BoolOption UnsupportedOption (false, '0', "allow-unsupported-windows", "Allow old, unsupported Windows versions");
+BoolOption UnsupportedOption (false, '\0', "allow-unsupported-windows", "Allow old, unsupported Windows versions");
 std::string SetupBaseName;
 
 static void inline
-- 
2.12.3

  parent reply	other threads:[~2017-06-06 11:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 11:54 [PATCH setup 0/9] Setup patches Jon Turney
2017-06-06 11:54 ` [PATCH setup 4/9] Add Option::isPresent() method Jon Turney
2017-06-06 11:54 ` [PATCH setup 2/9] Alphabetically sort options in usage help Jon Turney
2017-06-06 11:55 ` [PATCH setup 9/9] Avoid messagebox spam with file:// protocol URLs Jon Turney
2017-06-06 11:55 ` [PATCH setup 5/9] Allow user-agent string to be customized Jon Turney
2017-06-06 11:55 ` [PATCH setup 8/9] Fix useless error message Jon Turney
2017-06-06 11:55 ` Jon Turney [this message]
2017-06-06 11:55 ` [PATCH setup 6/9] Allow click-to-activate in PickView list control Jon Turney
2017-06-06 11:55 ` [PATCH setup 3/9] Access StringOption's value by reference Jon Turney
2017-06-06 11:55 ` [PATCH setup 7/9] Fix that clicking on any column changes "Keep" to "Uninstall" Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170606115432.105020-2-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).