--------------------------------------------------------------------------
| 221 | |
| 222 | // -------------------------------------------------------------------------- |
| 223 | string CommandLineParserArgumentDescription::helpText() |
| 224 | { |
| 225 | string text; |
| 226 | |
| 227 | string shortAndLongArg; |
| 228 | if (!this->ShortArg.empty()) |
| 229 | { |
| 230 | shortAndLongArg = " "; |
| 231 | shortAndLongArg += this->ShortArgPrefix; |
| 232 | shortAndLongArg += this->ShortArg; |
| 233 | } |
| 234 | |
| 235 | if (!this->LongArg.empty()) |
| 236 | { |
| 237 | if (this->ShortArg.empty()) |
| 238 | shortAndLongArg.append(" "); |
| 239 | else |
| 240 | shortAndLongArg.append(", "); |
| 241 | |
| 242 | shortAndLongArg += this->LongArgPrefix; |
| 243 | shortAndLongArg += this->LongArg; |
| 244 | } |
| 245 | |
| 246 | text = text + shortAndLongArg + ", " + this->ArgHelp; |
| 247 | |
| 248 | if (this->Optional) |
| 249 | text += " (optional)"; |
| 250 | |
| 251 | if (!this->DefaultValue.Empty()) |
| 252 | { |
| 253 | if (this->ValueType == 1) |
| 254 | { |
| 255 | if (this->DefaultValue.ToString() == "0") |
| 256 | text = text + ", (default: false)"; |
| 257 | else |
| 258 | text = text + ", (default: true)"; |
| 259 | } |
| 260 | else |
| 261 | text = text + ", (default: " + this->DefaultValue.ToString() + ")"; |
| 262 | } |
| 263 | string value_type = "Unknown"; |
| 264 | switch (this->ValueType) |
| 265 | { |
| 266 | case 0: |
| 267 | { |
| 268 | value_type = "String"; |
| 269 | break; |
| 270 | } |
| 271 | case 1: |
| 272 | { |
| 273 | value_type = "Bool"; |
| 274 | break; |
| 275 | } |
| 276 | case 2: |
| 277 | { |
| 278 | value_type = "StringList"; |
| 279 | break; |
| 280 | } |