This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch bugfix/help-cmd in repository x2goclient. from c6539db help.{cpp,h}: add skeleton for new help system. new 8587ec4 help.{cpp,h}: add sanitizing helpers. new abebff1 help.{cpp,h}: fix missing return type. new b8088ba help.cpp: populate pretty_print: fetch max length of params. The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 2 ++ src/help.cpp | 34 +++++++++++++++++++++++++++++++--- src/help.h | 4 ++++ 3 files changed, 37 insertions(+), 3 deletions(-) -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/help-cmd in repository x2goclient. commit abebff1cf86326cd0ace6d6828bd340fecac5637 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Apr 22 07:52:03 2015 +0200 help.{cpp,h}: fix missing return type. --- src/help.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/help.cpp b/src/help.cpp index 74dd1c0..4b39a49 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -75,7 +75,7 @@ help::data_t help::build_data () { return (help::data_t (help::cleanup_prelude (help::build_prelude ()), help::cleanup_params (help::build_params ()))); } -help::pretty_print (help::data_t data) { +void help::pretty_print (help::data_t data) { help::data_t data = help::build_data (); -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/help-cmd in repository x2goclient. commit 8587ec4d1288c1f5c4c4a04c5f2fc1f1815d47d7 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Apr 22 07:51:21 2015 +0200 help.{cpp,h}: add sanitizing helpers. --- debian/changelog | 1 + src/help.cpp | 21 +++++++++++++++++++-- src/help.h | 4 ++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1002103..926543b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -259,6 +259,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low correctly, add more quotes and use absolute file path for pulse cookie. - version.h: add include guard. - help.{cpp,h}: add skeleton for new help system. + - help.{cpp,h}: add sanitizing helpers. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index d42c881..74dd1c0 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -17,10 +17,27 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include "help.h" #include <QCoreApplication> +#include "help.h" #include "version.h" +help::prelude_t help::cleanup_prelude (help::prelude_t prelude) { + for (help::prelude_t::iterator it = prelude.begin (); it != prelude.end (); ++it) { + *it = (*it).trimmed (); + } + + return (prelude); +} + +help::params_t help::cleanup_params (help::params_t params) { + for (help::params_t::const_iterator params_it = params.constBegin (); params_it != params.constEnd (); ++params_it) { + (*params_it).first = (*params_it).first.trimmed (); + (*params_it).second = (*params_it).second.trimmed (); + } + + return (params); +} + help::prelude_t build_prelude () { help::prelude_t ret (); @@ -55,7 +72,7 @@ help::params_t help::build_params () { } help::data_t help::build_data () { - return (help::data_t (help::build_prelude (), help::build_params ())); + return (help::data_t (help::cleanup_prelude (help::build_prelude ()), help::cleanup_params (help::build_params ()))); } help::pretty_print (help::data_t data) { diff --git a/src/help.h b/src/help.h index 87cd5a7..8cc26b2 100644 --- a/src/help.h +++ b/src/help.h @@ -40,6 +40,10 @@ namespace help { /* Merges prelude_t and params_t into a data_t object. */ data_t build_data (); + /* Cleanup functions for string trimming. */ + prelude_t cleanup_prelude (prelude_t prelude); + params_t cleanup_params (params_t params); + /* Prints a help_data_t structure. */ void pretty_print (data_t data); } -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/help-cmd in repository x2goclient. commit b8088ba8cb9cfbf48c9249b9ee0cd2b86a11b6ac Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Apr 22 07:59:03 2015 +0200 help.cpp: populate pretty_print: fetch max length of params. --- debian/changelog | 1 + src/help.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index 926543b..987f88f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -260,6 +260,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - version.h: add include guard. - help.{cpp,h}: add skeleton for new help system. - help.{cpp,h}: add sanitizing helpers. + - help.cpp: populate pretty_print: fetch max length of params. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index 4b39a49..5201c12 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -18,6 +18,8 @@ ***************************************************************************/ #include <QCoreApplication> +#include <QtDebug> +#include <cstddef> #include "help.h" #include "version.h" @@ -78,5 +80,14 @@ help::data_t help::build_data () { void help::pretty_print (help::data_t data) { help::data_t data = help::build_data (); + QTextStream out << data.first.join ("\n") << "\n"; + std::size_t max_len = 0; + + /* Iterate over all parameter options and get max width. */ + for (help::params_t::const_iterator it = data.second.constBegin (); it != data.second.constEnd (); ++it) { + max_len = std::max (max_len, (*it).first.length ()); + } + + std::size_t indent = 0; } -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git