コード例 #1
0
ファイル: Program.cs プロジェクト: hjarraya/cassandra-sharp
        private static int Main(string[] args)
        {
            _cliArgs = new CliArgs();
            if (!CommandLineParser.ParseArguments(args, _cliArgs))
            {
                string usage = CommandLineParser.ArgumentsUsage(typeof(CliArgs));
                Console.WriteLine(usage);
                return 5;
            }

            string hostname = _cliArgs.Hostname;
            IStatementReader statementInput = new ConsoleInput(hostname);
            if (null != _cliArgs.File)
            {
                statementInput = new FileInput(_cliArgs.File);
            }

            CommandContext.DebugLog = _cliArgs.DebugLog;

            try
            {
                var statementReader = new StatementSplitter(statementInput);
                Run(statementReader);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Failed with error {0}", ex);
                return 5;
            }

            return 0;
        }