private static Command CreateInitCommand() { var command = new Command("init", "create a yaml manifest") { CommonArguments.Path_Optional, }; command.AddOption(new Option(new[] { "-f", "--force" }) { Description = "Overrides the tye.yaml file if already present for project.", Required = false }); command.Handler = CommandHandler.Create <IConsole, FileInfo?, bool>((console, path, force) => { var watch = System.Diagnostics.Stopwatch.StartNew(); var outputFilePath = InitHost.CreateTyeFile(path, force); console.Out.WriteLine($"Created '{outputFilePath}'."); watch.Stop(); TimeSpan elapsedTime = watch.Elapsed; console.Out.WriteLine($"Time Elapsed: {elapsedTime.Hours:00}:{elapsedTime.Minutes:00}:{elapsedTime.Seconds:00}:{elapsedTime.Milliseconds / 10:00}"); }); return(command); }
private static Command CreateInitCommand() { var command = new Command("init", "create a yaml manifest") { CommonArguments.Path_Optional, }; command.AddOption(new Option(new[] { "-f", "--force" }) { Description = "Overrides the tye.yaml file if already present for project.", Required = false }); command.Handler = CommandHandler.Create <IConsole, FileInfo?, bool>((console, path, force) => { var outputFilePath = InitHost.CreateTyeFile(path, force); console.Out.WriteLine($"Created '{outputFilePath}'."); }); return(command); }
private static Command CreateInitCommand() { var command = new Command("init", "create a yaml manifest") { CommonArguments.Path_Optional, StandardOptions.CreateForce("Overrides the tye.yaml file if already present for project.") }; command.Handler = CommandHandler.Create <InitCommandArguments>(args => { var watch = System.Diagnostics.Stopwatch.StartNew(); var output = new OutputContext(args.Console, args.Verbosity); var outputFilePath = InitHost.CreateTyeFile(args.Path, args.Force); output.WriteInfoLine($"Created '{outputFilePath}'."); watch.Stop(); var elapsedTime = watch.Elapsed; output.WriteInfoLine($"Time Elapsed: {elapsedTime.Hours:00}:{elapsedTime.Minutes:00}:{elapsedTime.Seconds:00}:{elapsedTime.Milliseconds / 10:00}"); }); return(command); }