private static int RunInteractiveMode(InteractiveModeOptions opts) { Console.CancelKeyPress += (s, e) => { e.Cancel = true; Environment.Exit(0); }; Console.WriteLine("Press Ctrl + C to stop the program.."); while (true) { try { Console.WriteLine("Input expression to parse:"); var expression = Console.ReadLine(); if (string.IsNullOrEmpty(expression)) { continue; } var result = ExpressionParser.Parse(expression); Console.WriteLine($"Canonical form: {result}"); } catch (Exception ex) { Console.WriteLine("Unexpected exception on expression processing: {0}", ex.Message); Console.WriteLine("Please check your expression"); } } }
/// <summary> /// Initializes an instance of <see cref="ScopeResetDirective"/>. /// </summary> public ScopeResetDirective(IOptions <InteractiveModeOptions> options) { _options = options.Value; }
/// <summary> /// Initializes an instance of <see cref="ScopeDirective"/>. /// </summary> public ScopeDirective(IOptions <InteractiveModeOptions> options, ICliContext cliContext) { _options = options.Value; _cliContext = cliContext; }