mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-10-31 09:09:25 +08:00 
			
		
		
		
	Improve conversion error messages
When a conversion to an enum fails, list all the valid enum values in the error message. Message before this commit: > Error: heimday is not a valid value for DayOfWeek. Message after this commit: > Error: Failed to convert 'heimday' to DayOfWeek. Valid values are 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
This commit is contained in:
		| @@ -1,4 +1,4 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Model> | ||||
|   <!--ANIMAL--> | ||||
|   <Command Name="animal" IsBranch="true" Settings="Spectre.Console.Tests.Data.AnimalSettings"> | ||||
| @@ -27,9 +27,9 @@ | ||||
|         </Parameters> | ||||
|       </Command> | ||||
|       <!--HORSE--> | ||||
|       <Command Name="horse" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.MammalSettings"> | ||||
|       <Command Name="horse" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.HorseSettings"> | ||||
|         <Parameters> | ||||
|           <Option Shadowed="true" Short="n,p" Long="name,pet-name" Value="VALUE" Required="false" Kind="scalar" ClrType="System.String" /> | ||||
|           <Option Short="d" Long="day" Value="NULL" Required="false" Kind="scalar" ClrType="System.DayOfWeek" /> | ||||
|         </Parameters> | ||||
|       </Command> | ||||
|     </Command> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Model> | ||||
|   <!--ANIMAL--> | ||||
|   <Command Name="animal" IsBranch="true" Settings="Spectre.Console.Tests.Data.AnimalSettings"> | ||||
| @@ -23,8 +23,9 @@ | ||||
|       </Parameters> | ||||
|     </Command> | ||||
|     <!--HORSE--> | ||||
|     <Command Name="horse" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.MammalSettings"> | ||||
|     <Command Name="horse" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.HorseSettings"> | ||||
|       <Parameters> | ||||
|         <Option Short="d" Long="day" Value="NULL" Required="false" Kind="scalar" ClrType="System.DayOfWeek" /> | ||||
|         <Option Short="n,p" Long="name,pet-name" Value="VALUE" Required="false" Kind="scalar" ClrType="System.String" /> | ||||
|       </Parameters> | ||||
|     </Command> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Model> | ||||
|   <!--DEFAULT COMMAND--> | ||||
|   <Command Name="__default_command" IsBranch="false" IsDefault="true" ClrType="Spectre.Console.Tests.Data.DogCommand" Settings="Spectre.Console.Tests.Data.DogSettings"> | ||||
| @@ -19,7 +19,7 @@ | ||||
|     </Parameters> | ||||
|   </Command> | ||||
|   <!--HORSE--> | ||||
|   <Command Name="horse" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.MammalSettings"> | ||||
|   <Command Name="horse" IsBranch="false" ClrType="Spectre.Console.Tests.Data.HorseCommand" Settings="Spectre.Console.Tests.Data.HorseSettings"> | ||||
|     <Parameters> | ||||
|       <Argument Name="LEGS" Position="0" Required="false" Kind="scalar" ClrType="System.Int32"> | ||||
|         <Description>The number of legs.</Description> | ||||
| @@ -31,6 +31,7 @@ | ||||
|       <Option Short="a" Long="alive,not-dead" Value="NULL" Required="false" Kind="flag" ClrType="System.Boolean"> | ||||
|         <Description>Indicates whether or not the animal is alive.</Description> | ||||
|       </Option> | ||||
|       <Option Short="d" Long="day" Value="NULL" Required="false" Kind="scalar" ClrType="System.DayOfWeek" /> | ||||
|       <Option Short="n,p" Long="name,pet-name" Value="VALUE" Required="false" Kind="scalar" ClrType="System.String" /> | ||||
|     </Parameters> | ||||
|   </Command> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Cédric Luthi
					Cédric Luthi