diff options
Diffstat (limited to 'src/optparser.cpp')
-rw-r--r-- | src/optparser.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/optparser.cpp b/src/optparser.cpp index 14e7418..081b26c 100644 --- a/src/optparser.cpp +++ b/src/optparser.cpp | |||
@@ -179,6 +179,11 @@ void Bu::OptParser::setOverride( const Bu::FString &sOpt, const Bu::FString &sOv | |||
179 | hlOption.get( sOpt )->sOverride = sOverride; | 179 | hlOption.get( sOpt )->sOverride = sOverride; |
180 | } | 180 | } |
181 | 181 | ||
182 | void Bu::OptParser::setHelpDefault( const Bu::FString &sOpt, const Bu::FString &sTxt ) | ||
183 | { | ||
184 | hlOption.get( sOpt )->sHelpDefault = sTxt; | ||
185 | } | ||
186 | |||
182 | void Bu::OptParser::addHelpOption( char c, const Bu::FString &s, const Bu::FString &sHelp ) | 187 | void Bu::OptParser::addHelpOption( char c, const Bu::FString &s, const Bu::FString &sHelp ) |
183 | { | 188 | { |
184 | Option o; | 189 | Option o; |
@@ -213,8 +218,9 @@ int Bu::OptParser::optHelp( StrArray /*aParams*/ ) | |||
213 | { | 218 | { |
214 | if( (*i).cOpt != '\0' ) | 219 | if( (*i).cOpt != '\0' ) |
215 | bHasShort = true; | 220 | bHasShort = true; |
216 | if( (*i).sOpt && iMaxWidth < (*i).sOpt.getSize() ) | 221 | int lOptSize = (*i).sOpt.getSize() + (*i).sHelpDefault.getSize(); |
217 | iMaxWidth = (*i).sOpt.getSize(); | 222 | if( (*i).sOpt && iMaxWidth < lOptSize ) |
223 | iMaxWidth = lOptSize; | ||
218 | } | 224 | } |
219 | int iIndent = 4; | 225 | int iIndent = 4; |
220 | if( bHasShort ) | 226 | if( bHasShort ) |
@@ -249,7 +255,8 @@ int Bu::OptParser::optHelp( StrArray /*aParams*/ ) | |||
249 | { | 255 | { |
250 | if( (*i).sOpt ) | 256 | if( (*i).sOpt ) |
251 | { | 257 | { |
252 | sio << "--" << Fmt(iMaxWidth, Fmt::Left) << (*i).sOpt; | 258 | sio << "--" << Fmt(iMaxWidth, Fmt::Left) |
259 | << (*i).sOpt + (*i).sHelpDefault; | ||
253 | } | 260 | } |
254 | else | 261 | else |
255 | { | 262 | { |