Ejemplo n.º 1
0
        public override Task <PromptCmdletResult> ExecuteAsync(TContext context, params string[] args)
        {
            var cmdlets     = context.Prompt.GetCmdlets(context);
            var columnWidth = cmdlets.Keys.Max(k => k.Length) + 1;

            foreach (var cmdlet in cmdlets.OrderBy(kvp => kvp.Key, StringComparer.CurrentCultureIgnoreCase))
            {
                var description = CommandDescriptionAttribute.GetDescription(cmdlet.Value.GetType()) ?? string.Empty;
                Console.WriteLine("{0} {1}", cmdlet.Key.PadRight(columnWidth), description);
            }

            return(Task.FromResult(PromptCmdletResult.Empty));
        }
Ejemplo n.º 2
0
        internal CommandInfo(Type commandType, CommandNameAttribute nameAttribute,
                             CommandDescriptionAttribute descriptionAttribute = null)
        {
            if (commandType == null)
            {
                throw new ArgumentNullException("commandType");
            }

            CommandType = commandType;

            Name = nameAttribute.Name;

            Description = descriptionAttribute != null
                ? descriptionAttribute.Description
                : String.Empty;
        }
Ejemplo n.º 3
0
        private void ReadCoreHelpInformation()
        {
            CommandDescriptionAttribute att = this._modelType.GetCustomAttribute <CommandDescriptionAttribute>();

            this.CommandDescription = att?.Description ?? "* Description not available *";
        }