Пример #1
0
        private static async Task RunHelpAsync(bool isHelp, string commandName, Dictionary <string, Func <IJobContext, Task> > pluginJobs)
        {
            if (isHelp || string.IsNullOrEmpty(commandName))
            {
                var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
                await Console.Out.WriteLineAsync($"Cli 命令行版本: {version.Substring(0, version.Length - 2)}");

                await Console.Out.WriteLineAsync($"当前文件夹: {CliUtils.PhysicalApplicationPath}");

                await Console.Out.WriteLineAsync($"Cli 命令行文件夹: {Assembly.GetExecutingAssembly().Location}");

                await Console.Out.WriteLineAsync();

                await CliUtils.PrintRowLine();

                await CliUtils.PrintRow("Usage");

                await CliUtils.PrintRowLine();

                var backupJob  = new BackupJob();
                var installJob = new InstallJob();
                var restoreJob = new RestoreJob();
                var syncJob    = new SyncJob();
                var updateJob  = new UpdateJob();
                var versionJob = new VersionJob();

                backupJob.PrintUsage();
                installJob.PrintUsage();
                restoreJob.PrintUsage();
                syncJob.PrintUsage();
                updateJob.PrintUsage();
                versionJob.PrintUsage();

                if (pluginJobs != null && pluginJobs.Count > 0)
                {
                    Console.WriteLine($"插件命令: {TranslateUtils.ObjectCollectionToString(pluginJobs.Keys)}");
                    Console.WriteLine();
                }

                await CliUtils.PrintRowLine();

                await CliUtils.PrintRow(CloudUtils.Root.DocsCliUrl);

                await CliUtils.PrintRowLine();

                Console.ReadLine();
            }
            else
            {
                Console.WriteLine($"'{commandName}' is not a siteserver command. See 'sitserver --help'");
            }
        }
Пример #2
0
        private static async Task RunHelpAsync(bool isHelp, string commandName)
        {
            if (isHelp || string.IsNullOrEmpty(commandName))
            {
                var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
                await Console.Out.WriteLineAsync($"Cli 命令行版本: {version.Substring(0, version.Length - 2)}");

                await Console.Out.WriteLineAsync($"当前文件夹: {CliUtils.PhysicalApplicationPath}");

                await Console.Out.WriteLineAsync($"Cli 命令行文件夹: {Assembly.GetExecutingAssembly().Location}");

                await Console.Out.WriteLineAsync();

                await CliUtils.PrintRowLine();

                await CliUtils.PrintRow("Usage");

                await CliUtils.PrintRowLine();

                BackupJob.PrintUsage();
                InstallJob.PrintUsage();
                RestoreJob.PrintUsage();
                UpdateJob.PrintUsage();
                VersionJob.PrintUsage();
                await CliUtils.PrintRowLine();

                await CliUtils.PrintRow("https://www.siteserver.cn/docs/cli");

                await CliUtils.PrintRowLine();

                Console.ReadLine();
            }
            else
            {
                Console.WriteLine($"'{commandName}' is not a siteserver command. See 'sitserver --help'");
            }
        }