Esempio n. 1
0
 public static void TestStandardConsole()
 {
     XAssert.AreEqual(10, StandardConsole.GetFirstLineLength(new string('A', 10) + Environment.NewLine + new string('A', 10)));
     XAssert.AreEqual(1, StandardConsole.ComputeLinesUsedByString(new string('A', 10), 20));
     XAssert.AreEqual(2, StandardConsole.ComputeLinesUsedByString(new string('A', 10), 6));
     XAssert.AreEqual(1, StandardConsole.ComputeLinesUsedByString(new string('A', 10), 10));
 }
Esempio n. 2
0
        public static void Main(string[] argv)
        {
            var console = new StandardConsole();
            var result  = new Program(console, new FileSystem(), GetDisplayVersion()).Run(argv);

            if (result.HasValue)
            {
                Environment.Exit(result.Value);
            }
        }
Esempio n. 3
0
        private static async Task Main(string[] args)
        {
            var console = new StandardConsole(args);
            var options = new ConsoleOptions
            {
                Title = "An Example App",
                AlwaysDisplayCommands  = true,
                WriteCommandsInline    = false,
                InvalidPromptTemplate  = "INVALID: {0}",
                InvalidPromptsTemplate = "INVALID",
            };

            var exampleProcess = BuildExampleProcess(console);

            await new ExampleConsoleApp(console, options, exampleProcess).RunAsync();
        }
Esempio n. 4
0
        public void EnsurePayloadParsableWithoutCrash()
        {
            StandardConsole console   = new StandardConsole(colorize: false, animateTaskbar: false, supportsOverwriting: false);
            BuildViewModel  viewModel = new BuildViewModel();

            viewModel.BuildSummary = new BuildSummary(Path.Combine(TestOutputDirectory, "test.md"));

            using (AzureDevOpsListener listener = new AzureDevOpsListener(Events.Log, console, DateTime.Now, viewModel, false, null))
            {
                listener.RegisterEventSource(global::BuildXL.Processes.ETWLogger.Log);
                global::BuildXL.Processes.Tracing.Logger.Log.PipProcessError(LoggingContext,
                                                                             pipSemiStableHash: 24,
                                                                             pipDescription: "my cool pip",
                                                                             pipSpecPath: @"specs\mypip.dsc",
                                                                             pipWorkingDirectory: @"specs\workingDir",
                                                                             pipExe: "coolpip.exe",
                                                                             outputToLog: "Failure message",
                                                                             extraOutputMessage: null,
                                                                             pathsToLog: null,
                                                                             exitCode: -1,
                                                                             optionalMessage: "what does this do?");
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Wrapper to get the consoles buffer width.
 /// </summary>
 private static int GetConsoleBufferWidth()
 {
     return(StandardConsole.GetConsoleWidth());
 }