Exemplo n.º 1
0
 public override Task <TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider services)
 {
     try
     {
         TimeUnit match = TimeUnit.Get(input);
         return(Task.FromResult(TypeReaderResult.FromSuccess(match)));
     }
     catch (NotExistingException)
     {
         string timeUnits = ListUtil.BuildEnumeration(TimeUnit.Values());
         return(Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, $"Time-Unit `{input}` doesn't exist. Choose one of `{timeUnits}`")));
     }
 }