当前位置: 首页>>代码示例>>C#>>正文


C# CommandLine.GetOption方法代码示例

本文整理汇总了C#中System.CommandLine.GetOption方法的典型用法代码示例。如果您正苦于以下问题:C# CommandLine.GetOption方法的具体用法?C# CommandLine.GetOption怎么用?C# CommandLine.GetOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.CommandLine的用法示例。


在下文中一共展示了CommandLine.GetOption方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public void Run(string[] args)
        {
            CommandLine commandLine = new CommandLine();
            commandLine.AddOption("Verbose", false, "-verbose");

            commandLine.Parse(args);

            if ((bool)commandLine.GetOption("-h"))
            {
                commandLine.Help("Katahdin Interpreter");
                return;
            }

            Runtime runtime = new Runtime(true, false, false, false,
                (bool)commandLine.GetOption("-verbose"));

            //new ConsoleParseTrace(runtime);

            runtime.SetUp(commandLine.Args);

            if (!((bool)commandLine.GetOption("-nostd")))
                runtime.ImportStandard();

            foreach (string file in commandLine.Files)
                runtime.Import(file);
        }
开发者ID:schuster-rainer,项目名称:katahdin,代码行数:26,代码来源:EntryPoint.cs

示例2: Main

        public static void Main(string[] args)
        {
            try
            {
                CommandLine commandLine = new CommandLine();
                commandLine.AddOption("Verbose", false, "-verbose");
                
                commandLine.Parse(args);
            
                if ((bool) commandLine.GetOption("-h"))
                {
                    commandLine.Help("Katahdin Interpreter");
                    return;
                }
                
                Runtime runtime = new Runtime(true, false, false, false,
                    (bool) commandLine.GetOption("-verbose"));
                
                //new ConsoleParseTrace(runtime);
                
                runtime.SetUp(commandLine.Args);
                
                if (!((bool) commandLine.GetOption("-nostd")))
                    runtime.ImportStandard();
                
                foreach (string file in commandLine.Files)
                    runtime.Import(file);
            }
            catch (Exception e)
            {
                /*while (true)
                {
                    TargetInvocationException wrapper
                        = e as TargetInvocationException;

                    if (wrapper == null)
                        break;

                    e = wrapper.InnerException;
                }*/
                
                Console.Error.WriteLine(e);
            }
        }
开发者ID:KevinKelley,项目名称:katahdin,代码行数:44,代码来源:EntryPoint.cs

示例3: NewSessionDialog

 public NewSessionDialog(Window parent, CommandLine commandLine)
     : base("New Katahdin Debugger Session", parent, DialogFlags.Modal
         | DialogFlags.DestroyWithParent)
 {
     WindowPosition = WindowPosition.CenterOnParent;
     
     AddActionWidget(new Button(Stock.Cancel), ResponseType.Cancel);
     AddActionWidget(new Button(Stock.Ok), ResponseType.Ok);
     
     VBox v = new VBox();
     v.BorderWidth = 5;
     VBox.PackStart(v, true, true, 0);
     
     ScrolledWindow fileScroller = new ScrolledWindow();
     fileScroller.BorderWidth = 5;
     fileScroller.ShadowType = ShadowType.In;
     v.PackStart(fileScroller, true, true, 0);
     
     fileStore = new ListStore(typeof(string));
     
     TreeView fileView = new TreeView(fileStore);
     fileView.AppendColumn("Input files", new CellRendererText(), "text", 0);
     fileScroller.Add(fileView);
     
     foreach (string file in commandLine.Files)
         fileStore.AppendValues(file);
     
     importStandard = new CheckButton("Import standard library");
     v.PackStart(importStandard, false, true, 0);
     
     importStandard.Active = ! (bool) commandLine.GetOption("-nostd");
     
     compileParser = new CheckButton("Compile parser");
     compileParser.Active = true;
     v.PackStart(compileParser, false, true, 0);
     
     debugGrammar = new CheckButton("Debug grammar");
     v.PackStart(debugGrammar, false, true, 0);
     
     debugParser = new CheckButton("Debug parser");
     v.PackStart(debugParser, false, true, 0);
     
     debugParseTrees = new CheckButton("Debug parse trees");
     v.PackStart(debugParseTrees, false, true, 0);
     
     ShowAll();
 }
开发者ID:KevinKelley,项目名称:katahdin,代码行数:47,代码来源:NewSessionDialog.cs


注:本文中的System.CommandLine.GetOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。