public UsageGraph(Type commandType) { _commandType = commandType; _inputType = commandType.FindInterfaceThatCloses(typeof(IOaktonCommand <>)).GetTypeInfo().GetGenericArguments().First(); _commandName = CommandFactory.CommandNameFor(commandType); _commandType.ForAttribute <DescriptionAttribute>(att => { _description = att.Description; }); if (_description == null) { _description = _commandType.Name; } _handlers = InputParser.GetHandlers(_inputType); _validUsages = new Lazy <IEnumerable <CommandUsage> >(() => { if (_usages.Any()) { return(_usages); } var usage = new CommandUsage() { Description = _description, Arguments = _handlers.OfType <Argument>(), ValidFlags = _handlers.Where(x => !(x is Argument)) }; return(new CommandUsage[] { usage }); }); }