Skip to content

Commit

Permalink
Fixed some typos in exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
icalvo committed Feb 8, 2022
1 parent 628d243 commit 5af77cb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/Cocona.Core/Command/CoconaCommandProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void AddCommand(CommandDescriptor command)
{
if (commandNames.Contains(command.Name))
{
throw new CoconaException($"Command '{command.Name}' has already exists. (Method: {command.Method.Name})");
throw new CoconaException($"Command '{command.Name}' already exists. (Method: {command.Method.Name})");
}
commandNames.Add(command.Name);

Expand All @@ -172,7 +172,7 @@ void AddCommand(CommandDescriptor command)
{
if (commandNames.Contains(alias))
{
throw new CoconaException($"Command alias '{alias}' has already exists in commands. (Method: {command.Method.Name})");
throw new CoconaException($"Command alias '{alias}' already exists in commands. (Method: {command.Method.Name})");
}
commandNames.Add(alias);
}
Expand Down Expand Up @@ -700,9 +700,9 @@ public void AddOption(CommandParameterAttributeSet attrSet, Type type, string na
var optionDescriptor = CreateOption(attrSet, type, name, defaultValue);

if (_allOptions.ContainsKey(optionDescriptor.Name))
throw new CoconaException($"Option '{optionDescriptor.Name}' is already exists.");
throw new CoconaException($"Option '{optionDescriptor.Name}' already exists.");
if (_allOptionShortNames.Count != 0 && optionDescriptor.ShortName.Count != 0 && _allOptionShortNames.IsSupersetOf(optionDescriptor.ShortName))
throw new CoconaException($"Short name option '{string.Join(",", optionDescriptor.ShortName)}' is already exists.");
throw new CoconaException($"Short name option '{string.Join(",", optionDescriptor.ShortName)}' already exists.");

_allOptions.Add(optionDescriptor.Name, optionDescriptor);
_allOptionShortNames.UnionWith(optionDescriptor.ShortName);
Expand Down Expand Up @@ -789,9 +789,9 @@ public void AddOption(CommandParameterAttributeSet attrSet, Type type, string na
var optionDescriptor = _parent.CreateOption(attrSet, type, name, defaultValue);

if (_parent._allOptions.ContainsKey(optionDescriptor.Name))
throw new CoconaException($"Option '{optionDescriptor.Name}' is already exists.");
throw new CoconaException($"Option '{optionDescriptor.Name}' already exists.");
if (_parent._allOptionShortNames.Count != 0 && optionDescriptor.ShortName.Count != 0 && _parent._allOptionShortNames.IsSupersetOf(optionDescriptor.ShortName))
throw new CoconaException($"Short name option '{string.Join(",", optionDescriptor.ShortName)}' is already exists.");
throw new CoconaException($"Short name option '{string.Join(",", optionDescriptor.ShortName)}' already exists.");

_parent._allOptions.Add(optionDescriptor.Name, optionDescriptor);
_parent._allOptionShortNames.UnionWith(optionDescriptor.ShortName);
Expand Down
2 changes: 1 addition & 1 deletion src/Cocona.Core/Command/CommandCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public CommandCollection(IReadOnlyList<CommandDescriptor> commands)
{
if (Primary != null)
{
throw new CoconaException($"The commands contains more then one primary command. A primary command must be only one.: {string.Join(", ", commands.Where(x => x.IsPrimaryCommand).Select(x => x.Name))}");
throw new CoconaException($"The commands contain more than one primary command. A primary command must be unique.: {string.Join(", ", commands.Where(x => x.IsPrimaryCommand).Select(x => x.Name))}");
}
Primary = command;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cocona.Core/Command/Dispatcher/CoconaCommandMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public CommandDescriptor ResolveOverload(CommandDescriptor command, ParsedComman
{
if ((overloadCommand.Value == null) || (value.Value != null && overloadCommand.Comparer.Equals(value.Value, overloadCommand.Value)))
{
if (resolvedCommand != null) throw new CoconaException($"Command '{command.Name}' and option '{overloadCommand.Option}' has option overloads more than one.");
if (resolvedCommand != null) throw new CoconaException($"Command '{command.Name}' and option '{overloadCommand.Option}' has more than one option overloads.");
resolvedCommand = overloadCommand.Command;
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void TypeCommandData_PrimaryCommand_Duplicate()
new TypeCommandData(typeof(CommandTestSingleCommand), new object[] { new CommandNameMetadata("B"), new PrimaryCommandAttribute() }),
});

Assert.Throws<CoconaException>(() => provider.GetCommandCollection()).Message.Should().Contain("The commands contains more then one primary command.");
Assert.Throws<CoconaException>(() => provider.GetCommandCollection()).Message.Should().Contain("The commands contain more than one primary command.");
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void Unnamed_SingleCommand_Duplicated()
app.AddCommand(() => Console.WriteLine("Hello Konnichiwa!"));
app.Run();
});
}).Message.Should().Contain("The commands contains more then one primary command");
}).Message.Should().Contain("The commands contain more than one primary command");
}

[Fact]
Expand Down

0 comments on commit 5af77cb

Please sign in to comment.