Exemplo n.º 1
0
        public static int Main(string[] args)
        {
            try
            {

                Initialize();

                var options = new HadronOptions();

                var verbs = Verb.Parse(args, options);

                if (verbs == null)
                {
                    return Parser.DefaultExitCodeFail;
                }

                // Hadron code
                foreach (var verb in verbs)
                {
                    verb.Run();
                }

                Log.Information($"{nameof(Hadron)} done");
                return 0;
            }
            catch (Exception e)
            {
                Log.Error(e, $"Error running {nameof(Hadron)}");
                return -1;
            }
        }
Exemplo n.º 2
0
        public static IEnumerable<Verb> Parse(string[] args, HadronOptions options)
        {
            var verbs = new List<Verb>();
            if (Parser.Default.ParseArguments(args, options, (s, o) => verbs.Add((Verb)o)))
            {
                return verbs;
            }

            return null;
        }