File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 4
4
New features:
5
5
6
6
* Fix GitHub Issue #2: Configurable value names for help
7
+ * Add getter for help text
7
8
8
9
Bug fixes:
9
10
Original file line number Diff line number Diff line change @@ -79,6 +79,11 @@ class Argengine::Impl
79
79
m_helpText = helpText;
80
80
}
81
81
82
+ std::string helpText () const
83
+ {
84
+ return m_helpText;
85
+ }
86
+
82
87
void setHelpSorting (HelpSorting helpSorting)
83
88
{
84
89
m_helpSorting = helpSorting;
@@ -458,6 +463,11 @@ void Argengine::setHelpText(std::string helpText)
458
463
m_impl->setHelpText (helpText);
459
464
}
460
465
466
+ std::string Argengine::helpText () const
467
+ {
468
+ return m_impl->helpText ();
469
+ }
470
+
461
471
void Argengine::setHelpSorting (HelpSorting helpSorting)
462
472
{
463
473
m_impl->setHelpSorting (helpSorting);
Original file line number Diff line number Diff line change @@ -81,6 +81,9 @@ class Argengine
81
81
// ! \param helpText Text shown in help. E.g. "MyApplication v1.0.0, Copyright (c) 2020 Foo Bar".
82
82
void setHelpText (std::string helpText);
83
83
84
+ // ! \return The current help text.
85
+ std::string helpText () const ;
86
+
84
87
// ! Sorting order of arguments in help.
85
88
enum class HelpSorting
86
89
{
Original file line number Diff line number Diff line change @@ -102,6 +102,14 @@ void testDefaultHelp_SingleValueOptionAdded_ShouldSucceed()
102
102
assert (ss.str () == answer);
103
103
}
104
104
105
+ void testSetGetHelpText_ShouldSucceed ()
106
+ {
107
+ Argengine ae ({ " test" });
108
+ assert (ae.helpText () == " Usage: test [OPTIONS]" );
109
+ ae.setHelpText (" Foo" );
110
+ assert (ae.helpText () == " Foo" );
111
+ }
112
+
105
113
int main (int , char **)
106
114
{
107
115
testDefaultHelpOverride_HelpActive_ShouldFail ();
@@ -114,5 +122,7 @@ int main(int, char **)
114
122
115
123
testDefaultHelp_SingleValueOptionAdded_ShouldSucceed ();
116
124
125
+ testSetGetHelpText_ShouldSucceed ();
126
+
117
127
return EXIT_SUCCESS;
118
128
}
You can’t perform that action at this time.
0 commit comments