private void PopulateBasicCommandInfo(StringBuilder sb) { var help = new CommentStore(); help.ReadComments(Environment.CurrentDirectory); // Basic info about command sb.AppendLine("Name: " + _commandType.Name); var helpText = help.GetTypeDocumentationIfExists(_commandType); if (helpText != null) { sb.AppendLine(); sb.AppendLine("Description: " + helpText); } sb.AppendLine(); sb.AppendLine("USAGE: "); sb.Append(EnvironmentInfo.IsLinux ? "./rdmp" : "./rdmp.exe"); sb.Append(" cmd "); sb.Append(BasicCommandExecution.GetCommandName(_commandType.Name)); sb.Append(" "); }
public string WhatIsThis() { var useCaseType = UseCase.GetType(); string useCaseDescription = string.Format("{0} \r\n {1}", useCaseType.Name, _commentStore.GetTypeDocumentationIfExists(useCaseType, false, true)); return("Collection of all the Pipelines compatible with a given use case. This node's use case is:" + Environment.NewLine + useCaseDescription); }
public void Check(ICheckNotifier notifier) { foreach (Type t in _mef.GetAllTypes().Where(t => typeof(DatabaseEntity).IsAssignableFrom(t))) { if (typeof(IMapsDirectlyToDatabaseTable).IsAssignableFrom(t)) { if (t.IsInterface || t.IsAbstract || t.Name.StartsWith("Spontaneous")) { continue; } try { //spontaneous objects don't exist in the database. if (typeof(SpontaneousObject).IsAssignableFrom(t)) { continue; } } catch (Exception) { continue; } notifier.OnCheckPerformed(new CheckEventArgs("Found type " + t, CheckResult.Success)); var docs = _commentStore.GetTypeDocumentationIfExists(t, true, true); if (docs == null) { notifier.OnCheckPerformed( new CheckEventArgs("Failed to get definition for class " + t.FullName, CheckResult.Fail)); } else { Summaries.Add(t, docs); } } } }
public override void Execute() { base.Execute(); var invoker = new CommandInvoker(BasicActivator); var commandCtor = invoker.GetConstructor(_commandType); var help = new CommentStore(); help.ReadComments(Environment.CurrentDirectory); var sb = new StringBuilder(); if (commandCtor == null || !invoker.IsSupported(commandCtor)) { sb.AppendLine($"Command '{_commandType.Name}' is not supported by the current input type ({BasicActivator.GetType().Name})"); } else { sb.AppendLine("COMMAND:" + _commandType.FullName); var helpText = help.GetTypeDocumentationIfExists(_commandType); if (helpText != null) { sb.AppendLine(helpText); } sb.AppendLine("USAGE:"); sb.Append(EnvironmentInfo.IsLinux ? "./rdmp" : "./rdmp.exe"); sb.Append(" cmd "); sb.Append(BasicCommandExecution.GetCommandName(_commandType.Name)); sb.Append(" "); var sbParameters = new StringBuilder(); sbParameters.AppendLine("PARAMETERS:"); foreach (ParameterInfo p in commandCtor.GetParameters()) { var req = new RequiredArgument(p); //automatic delegates require no user input or CLI entry (e.g. IActivateItems) if (invoker.GetDelegate(req).IsAuto) { continue; } sb.Append($"<{req.Name}> "); sbParameters.AppendLine($"{req.Name}\t{req.Type.Name}\t{req.DemandIfAny?.Description}"); } sb.AppendLine(); sb.AppendLine(sbParameters.ToString()); } BasicActivator.Show(sb.ToString()); }