Skip to content

Commit 7549ee9

Browse files
committed
Include name of argument when an argument is missing
1 parent 7d20fca commit 7549ee9

17 files changed

+34
-33
lines changed

src/System.CommandLine.Tests/LocalizationTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ namespace System.CommandLine.Tests
77
public class LocalizationTests
88
{
99
private const string CommandName = "the-command";
10+
private const string ArgumentName = "arg";
1011

1112
[Theory]
12-
[InlineData("es", $"Falta el argumento requerido para el comando: '{CommandName}'.")]
13-
[InlineData("en-US", $"Required argument missing for command: '{CommandName}'.")]
13+
[InlineData("es", $"Falta el argumento requerido '{ArgumentName}' para el comando: '{CommandName}'.")]
14+
[InlineData("en-US", $"Required argument '{ArgumentName}' missing for command: '{CommandName}'.")]
1415
public void ErrorMessages_AreLocalized(string cultureName, string expectedMessage)
1516
{
1617
CultureInfo uiCultureBefore = CultureInfo.CurrentUICulture;

src/System.CommandLine/LocalizationResources.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ internal static string InvalidCharactersInFileName(char invalidChar) =>
5050
GetResourceString(Properties.Resources.InvalidCharactersInFileName, invalidChar);
5151

5252
/// <summary>
53-
/// Interpolates values into a localized string similar to Required argument missing for command: {0}.
53+
/// Interpolates values into a localized string similar to Required argument '{0}' missing for command: '{1}'.
5454
/// </summary>
5555
internal static string RequiredArgumentMissing(ArgumentResult argumentResult) =>
5656
argumentResult.Parent is CommandResult commandResult
57-
? GetResourceString(Properties.Resources.CommandRequiredArgumentMissing, commandResult.IdentifierToken.Value)
57+
? GetResourceString(Properties.Resources.CommandRequiredArgumentMissing, argumentResult.Argument.Name, commandResult.IdentifierToken.Value)
5858
: RequiredArgumentMissing((OptionResult)argumentResult.Parent!);
5959

6060
/// <summary>

src/System.CommandLine/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
<value>Character not allowed in a path: '{0}'.</value>
134134
</data>
135135
<data name="CommandRequiredArgumentMissing" xml:space="preserve">
136-
<value>Required argument missing for command: '{0}'.</value>
136+
<value>Required argument '{0}' missing for command: '{1}'.</value>
137137
</data>
138138
<data name="OptionRequiredArgumentMissing" xml:space="preserve">
139139
<value>Required argument missing for option: '{0}'.</value>

src/System.CommandLine/Properties/xlf/Resources.cs.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<note />
2929
</trans-unit>
3030
<trans-unit id="CommandRequiredArgumentMissing">
31-
<source>Required argument missing for command: '{0}'.</source>
32-
<target state="translated">Chybí povinný argument pro příkaz: '{0}'.</target>
31+
<source>Required argument '{0}' missing for command: '{1}'.</source>
32+
<target state="translated">Chybí povinný argument '{0}' pro příkaz: '{1}'.</target>
3333
<note />
3434
</trans-unit>
3535
<trans-unit id="DirectoryDoesNotExist">

src/System.CommandLine/Properties/xlf/Resources.de.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<note />
2929
</trans-unit>
3030
<trans-unit id="CommandRequiredArgumentMissing">
31-
<source>Required argument missing for command: '{0}'.</source>
32-
<target state="translated">Ein erforderliches Argument fehlt für den Befehl: '{0}'.</target>
31+
<source>Required argument '{0}' missing for command: '{1}'.</source>
32+
<target state="translated">Ein erforderliches Argument '{0}' fehlt für den Befehl: '{1}'.</target>
3333
<note />
3434
</trans-unit>
3535
<trans-unit id="DirectoryDoesNotExist">

src/System.CommandLine/Properties/xlf/Resources.es.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<note />
2929
</trans-unit>
3030
<trans-unit id="CommandRequiredArgumentMissing">
31-
<source>Required argument missing for command: '{0}'.</source>
32-
<target state="translated">Falta el argumento requerido para el comando: '{0}'.</target>
31+
<source>Required argument '{0}' missing for command: '{1}'.</source>
32+
<target state="translated">Falta el argumento requerido '{0}' para el comando: '{1}'.</target>
3333
<note></note>
3434
</trans-unit>
3535
<trans-unit id="DirectoryDoesNotExist">

src/System.CommandLine/Properties/xlf/Resources.fi.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<note />
2929
</trans-unit>
3030
<trans-unit id="CommandRequiredArgumentMissing">
31-
<source>Required argument missing for command: '{0}'.</source>
32-
<target state="translated">Pakollinen argumentti puuttuu komennolta: '{0}'.</target>
31+
<source>Required argument '{0}' missing for command: '{1}'.</source>
32+
<target state="translated">Pakollinen argumentti '{0}' puuttuu komennolta: '{1}'.</target>
3333
<note />
3434
</trans-unit>
3535
<trans-unit id="DirectoryDoesNotExist">

src/System.CommandLine/Properties/xlf/Resources.fr.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<note />
2929
</trans-unit>
3030
<trans-unit id="CommandRequiredArgumentMissing">
31-
<source>Required argument missing for command: '{0}'.</source>
32-
<target state="translated">Argument obligatoire manquant pour la commande : '{0}'.</target>
31+
<source>Required argument '{0}' missing for command: '{1}'.</source>
32+
<target state="translated">Argument obligatoire '{0}' manquant pour la commande : '{1}'.</target>
3333
<note />
3434
</trans-unit>
3535
<trans-unit id="DirectoryDoesNotExist">

src/System.CommandLine/Properties/xlf/Resources.it.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<note />
2929
</trans-unit>
3030
<trans-unit id="CommandRequiredArgumentMissing">
31-
<source>Required argument missing for command: '{0}'.</source>
32-
<target state="translated">Manca l'argomento obbligatorio per il comando: '{0}'.</target>
31+
<source>Required argument '{0}' missing for command: '{1}'.</source>
32+
<target state="translated">Manca l'argomento obbligatorio '{0}' per il comando: '{1}'.</target>
3333
<note />
3434
</trans-unit>
3535
<trans-unit id="DirectoryDoesNotExist">

src/System.CommandLine/Properties/xlf/Resources.ja.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<note />
2929
</trans-unit>
3030
<trans-unit id="CommandRequiredArgumentMissing">
31-
<source>Required argument missing for command: '{0}'.</source>
32-
<target state="translated">必要な引数がコマンドにありません: '{0}'.</target>
31+
<source>Required argument '{0}' missing for command: '{1}'.</source>
32+
<target state="translated">必要な引数 '{0}' がコマンド '{1}' にありません。</target>
3333
<note />
3434
</trans-unit>
3535
<trans-unit id="DirectoryDoesNotExist">

0 commit comments

Comments
 (0)