From 7a41c195298af2ce4e47c267b5b64039cd890833 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 4 Apr 2018 15:13:54 +0200 Subject: shiboken: Reformat help Print option descriptions indented by 8 below the option instead of beside the option at column 38 and add some newlines to avoid wrapping. Change-Id: I63295a40aaac588f761c5964b68dbaff8d013c95 Reviewed-by: Christian Tismer --- sources/shiboken2/generator/main.cpp | 23 ++++++++++++++-------- .../shiboken2/generator/qtdoc/qtdocgenerator.cpp | 5 +++-- .../generator/shiboken2/shibokengenerator.cpp | 12 +++++++---- 3 files changed, 26 insertions(+), 14 deletions(-) (limited to 'sources/shiboken2') diff --git a/sources/shiboken2/generator/main.cpp b/sources/shiboken2/generator/main.cpp index 774775fb0..b787d9f7e 100644 --- a/sources/shiboken2/generator/main.cpp +++ b/sources/shiboken2/generator/main.cpp @@ -146,13 +146,18 @@ static void printOptions(QTextStream& s, const OptionDescriptions& options) { s.setFieldAlignment(QTextStream::AlignLeft); for (const auto &od : options) { - s << ' '; if (!od.first.startsWith(QLatin1Char('-'))) s << "--"; - s.setFieldWidth(38); - s << od.first << od.second; - s.setFieldWidth(0); - s << endl; + s << od.first; + if (od.second.isEmpty()) { + s << ", "; + } else { + s << endl; + const auto lines = od.second.splitRef(QLatin1Char('\n')); + for (const auto &line : lines) + s << " " << line << endl; + s << endl; + } } } @@ -348,7 +353,8 @@ void printUsage() << qMakePair(QLatin1String("documentation-only"), QLatin1String("Do not generates any code, just the documentation")) << qMakePair(QLatin1String("drop-type-entries=\"[;TypeEntry1;...]\""), - QLatin1String("Semicolon separated list of type system entries (classes, namespaces, global functions and enums) to be dropped from generation.")) + QLatin1String("Semicolon separated list of type system entries (classes, namespaces,\n" + "global functions and enums) to be dropped from generation.")) << qMakePair(QLatin1String("-F") + pathSyntax, QString()) << qMakePair(QLatin1String("framework-include-paths=") + pathSyntax, QLatin1String("Framework include paths used by the C++ parser")) @@ -367,7 +373,8 @@ void printUsage() << qMakePair(QLatin1String("output-directory="), QLatin1String("The directory where the generated files will be written")) << qMakePair(QLatin1String("project-file="), - QLatin1String("text file containing a description of the binding project. Replaces and overrides command line arguments")) + QLatin1String("text file containing a description of the binding project.\n" + "Replaces and overrides command line arguments")) << qMakePair(QLatin1String("silent"), QLatin1String("Avoid printing any message")) << qMakePair(QLatin1String("-T") + pathSyntax, QString()) @@ -381,7 +388,7 @@ void printUsage() for (const GeneratorPtr &generator : generators) { const OptionDescriptions options = generator->options(); if (!options.isEmpty()) { - s << endl << generator->name() << " options:\n"; + s << endl << generator->name() << " options:\n\n"; printOptions(s, generator->options()); } } diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp index 842c68b90..11e66d0cc 100644 --- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp @@ -1996,11 +1996,12 @@ Generator::OptionDescriptions QtDocGenerator::options() const { return OptionDescriptions() << qMakePair(QLatin1String("doc-parser"), - QLatin1String("The documentation parser used to interpret the documentation input files (qdoc3|doxygen)")) + QLatin1String("The documentation parser used to interpret the documentation\n" + "input files (qdoc|doxygen)")) << qMakePair(QLatin1String("documentation-code-snippets-dir"), QLatin1String("Directory used to search code snippets used by the documentation")) << qMakePair(QLatin1String("documentation-data-dir"), - QLatin1String("Directory with XML files generated by documentation tool (qdoc3 or Doxygen)")) + QLatin1String("Directory with XML files generated by documentation tool")) << qMakePair(QLatin1String("documentation-extra-sections-dir"), QLatin1String("Directory used to search for extra documentation sections")) << qMakePair(QLatin1String("library-source-dir"), diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp index d64719bb8..bb8f95617 100644 --- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp @@ -2513,15 +2513,19 @@ Generator::OptionDescriptions ShibokenGenerator::options() const << qMakePair(QLatin1String(AVOID_PROTECTED_HACK), QLatin1String("Avoid the use of the '#define protected public' hack.")) << qMakePair(QLatin1String(DISABLE_VERBOSE_ERROR_MESSAGES), - QLatin1String("Disable verbose error messages. Turn the python code hard to debug but safe few kB on the generated bindings.")) + QLatin1String("Disable verbose error messages. Turn the python code hard to debug\n" + "but safe few kB on the generated bindings.")) << qMakePair(QLatin1String(PARENT_CTOR_HEURISTIC), QLatin1String("Enable heuristics to detect parent relationship on constructors.")) << qMakePair(QLatin1String(ENABLE_PYSIDE_EXTENSIONS), - QLatin1String("Enable PySide extensions, such as support for signal/slots, use this if you are creating a binding for a Qt-based library.")) + QLatin1String("Enable PySide extensions, such as support for signal/slots,\n" + "use this if you are creating a binding for a Qt-based library.")) << qMakePair(QLatin1String(RETURN_VALUE_HEURISTIC), - QLatin1String("Enable heuristics to detect parent relationship on return values (USE WITH CAUTION!)")) + QLatin1String("Enable heuristics to detect parent relationship on return values\n" + "(USE WITH CAUTION!)")) << qMakePair(QLatin1String(USE_ISNULL_AS_NB_NONZERO), - QLatin1String("If a class have an isNull()const method, it will be used to compute the value of boolean casts")); + QLatin1String("If a class have an isNull() const method, it will be used to compute\n" + "the value of boolean casts")); } static void getCode(QStringList& code, const CodeSnipList& codeSnips) -- cgit v1.2.3