diff --git a/CommandLine.nuspec b/CommandLine.nuspec
index 86eb1a0c..e9bb6428 100644
--- a/CommandLine.nuspec
+++ b/CommandLine.nuspec
@@ -16,19 +16,19 @@
command line commandline argument option parser parsing library syntax shell
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/CommandLine/Text/HelpText.cs b/src/CommandLine/Text/HelpText.cs
index eaa6ade5..3821c7d9 100644
--- a/src/CommandLine/Text/HelpText.cs
+++ b/src/CommandLine/Text/HelpText.cs
@@ -416,7 +416,6 @@ public HelpText AddOptions(ParserResult result)
return AddOptionsImpl(
GetSpecificationsFromType(result.TypeInfo.Current),
- SentenceBuilder.RequiredWord(),
MaximumDisplayWidth);
}
@@ -433,7 +432,6 @@ public HelpText AddVerbs(params Type[] types)
return AddOptionsImpl(
AdaptVerbsToSpecifications(types),
- SentenceBuilder.RequiredWord(),
MaximumDisplayWidth);
}
@@ -449,7 +447,6 @@ public HelpText AddOptions(int maximumLength, ParserResult result)
return AddOptionsImpl(
GetSpecificationsFromType(result.TypeInfo.Current),
- SentenceBuilder.RequiredWord(),
maximumLength);
}
@@ -467,7 +464,6 @@ public HelpText AddVerbs(int maximumLength, params Type[] types)
return AddOptionsImpl(
AdaptVerbsToSpecifications(types),
- SentenceBuilder.RequiredWord(),
maximumLength);
}
@@ -720,7 +716,6 @@ private IEnumerable AdaptVerbsToSpecifications(IEnumerable
private HelpText AddOptionsImpl(
IEnumerable specifications,
- string requiredWord,
int maximumLength)
{
var maxLength = GetMaxLength(specifications);
@@ -731,7 +726,7 @@ private HelpText AddOptionsImpl(
specifications.ForEach(
option =>
- AddOption(requiredWord, maxLength, option, remainingSpace));
+ AddOption(maxLength, option, remainingSpace));
return this;
}
@@ -765,7 +760,7 @@ private HelpText AddPreOptionsLine(string value, int maximumLength)
return this;
}
- private HelpText AddOption(string requiredWord, int maxLength, Specification specification, int widthOfHelpText)
+ private HelpText AddOption(int maxLength, Specification specification, int widthOfHelpText)
{
if (specification.Hidden)
return this;
@@ -784,13 +779,13 @@ private HelpText AddOption(string requiredWord, int maxLength, Specification spe
var optionHelpText = specification.HelpText;
if (addEnumValuesToHelpText && specification.EnumValues.Any())
- optionHelpText += " Valid values: " + string.Join(", ", specification.EnumValues);
+ optionHelpText += " {0}: ".FormatInvariant(SentenceBuilder.ValidValuesPhrase()) + string.Join(", ", specification.EnumValues);
specification.DefaultValue.Do(
- defaultValue => optionHelpText = "(Default: {0}) ".FormatInvariant(FormatDefaultValue(defaultValue)) + optionHelpText);
+ defaultValue => optionHelpText = "({0}: {1}) ".FormatInvariant(SentenceBuilder.DefaultWord(), FormatDefaultValue(defaultValue)) + optionHelpText);
if (specification.Required)
- optionHelpText = "{0} ".FormatInvariant(requiredWord) + optionHelpText;
+ optionHelpText = "{0} ".FormatInvariant(SentenceBuilder.RequiredWord()) + optionHelpText;
if (!string.IsNullOrEmpty(optionHelpText))
{
@@ -860,8 +855,8 @@ private string AddValueName(int maxLength, ValueSpecification specification)
return new StringBuilder(maxLength)
.BimapIf(
specification.MetaName.Length > 0,
- it => it.AppendFormat("{0} (pos. {1})", specification.MetaName, specification.Index),
- it => it.AppendFormat("value pos. {0}", specification.Index))
+ it => it.AppendFormat("{0} ({1} {2})", specification.MetaName, SentenceBuilder.PositionWord(), specification.Index),
+ it => it.AppendFormat("{0} {1}", SentenceBuilder.ValuePositionPhrase(), specification.Index))
.AppendFormatWhen(
specification.MetaValue.Length > 0, " {0}", specification.MetaValue)
.ToString();
diff --git a/src/CommandLine/Text/SentenceBuilder.cs b/src/CommandLine/Text/SentenceBuilder.cs
index 1c28e959..2ea30f11 100644
--- a/src/CommandLine/Text/SentenceBuilder.cs
+++ b/src/CommandLine/Text/SentenceBuilder.cs
@@ -33,6 +33,26 @@ public static SentenceBuilder Create()
///
public abstract Func RequiredWord { get; }
+ ///
+ /// Gets a delegate that returns the word 'Default'.
+ ///
+ public abstract Func DefaultWord { get; }
+
+ ///
+ /// Gets a delegate that returns the word 'pos.'.
+ ///
+ public abstract Func PositionWord { get; }
+
+ ///
+ /// Gets a delegate that returns the phrase 'value pos.'.
+ ///
+ public abstract Func ValuePositionPhrase { get; }
+
+ ///
+ /// Gets a delegate that returns the phrase 'Valid values'.
+ ///
+ public abstract Func ValidValuesPhrase { get; }
+
///
/// Gets a delegate that returns that errors block heading text.
///
@@ -74,6 +94,26 @@ public override Func RequiredWord
get { return () => "Required."; }
}
+ public override Func DefaultWord
+ {
+ get { return () => "Default"; }
+ }
+
+ public override Func PositionWord
+ {
+ get { return () => "pos."; }
+ }
+
+ public override Func ValuePositionPhrase
+ {
+ get { return () => "value pos."; }
+ }
+
+ public override Func ValidValuesPhrase
+ {
+ get { return () => "Valid values"; }
+ }
+
public override Func ErrorsHeadingText
{
get { return () => "ERROR(S):"; }