/// <summary> /// Show sample C# script file. /// </summary> public void Sample(string appType, string outFile) { if (appType == null && outFile == null) { print?.Invoke(HelpProvider.BuildSampleHelp()); } else { var context = outFile; if (appType == "cmd") { context = outFile ?? "-new_command"; } foreach (var sample in HelpProvider.BuildSampleCode(appType, context)) { if (outFile.IsNotEmpty()) { if (appType == "cmd" && outFile.GetDirName().IsEmpty()) { // the command output file specified by command name only outFile = Runtime.CustomCommandsDir.PathJoin(outFile); } var file = Path.GetFullPath(outFile).ChangeExtension(sample.FileExtension); print?.Invoke($"Created: {file}"); File.WriteAllText(file, sample.Code); } else { print?.Invoke($"{NewLine}{context}{sample.FileExtension}:{NewLine}----------"); print?.Invoke(sample.Code); } } } }
/// <summary> /// Prints CS-Script specific C# syntax help info. /// </summary> public void ShowHelp(string helpType, params object[] context) { print?.Invoke(HelpProvider.ShowHelp(helpType, context.Where(x => x != null).ToArray())); }
/// <summary> /// Show CS-Script version information. /// </summary> public void ShowVersion(string arg = null) { print(HelpProvider.BuildVersionInfo(arg)); }
/// <summary> /// Prints Help info. /// </summary> public void ShowHelpFor(string arg) { print?.Invoke(HelpProvider.BuildCommandInterfaceHelp(arg)); }