Manos.Tool.Driver.Main C# (CSharp) Method

Main() public static method

public static Main ( string args ) : int
args string
return int
        public static int Main(string[] args)
        {
            args = ParseGlobalOptions (args);

            bool help = false;
            Func<IList<string>, int> command = null;

            var p = new OptionSet () {
                { "h|?|help", v => help = v != null },
                { "init|i", v => command = Init },
                { "server|s", v => command = Server },
                { "docs|d", v => command = Docs },
                { "build|b", v => command = Build },
                { "show-environment|se", v => command = ShowEnvironment },
                { "run|r=", v => command = a => { return Run(v, a); } },
            };

            List<string> extra = null;
            try {
                extra = p.Parse(args);
            } catch (OptionException){
                Console.WriteLine ("Try `manos --help' for more information.");
                return 1;
            }

            if (help) {
                ShowHelp (p);
                return 0;
            }

            if (command == null) {
                ShowHelp (p);
                return 1;
            }

            command (extra);

            return 0;
        }