Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 1 | // Licensed to the Apache Software Foundation(ASF) under one |
| 2 | // or more contributor license agreements.See the NOTICE file |
| 3 | // distributed with this work for additional information |
| 4 | // regarding copyright ownership.The ASF licenses this file |
| 5 | // to you under the Apache License, Version 2.0 (the |
| 6 | // "License"); you may not use this file except in compliance |
| 7 | // with the License. You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, |
| 12 | // software distributed under the License is distributed on an |
| 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | // KIND, either express or implied. See the License for the |
| 15 | // specific language governing permissions and limitations |
| 16 | // under the License. |
| 17 | |
| 18 | using System; |
| 19 | using System.Collections.Generic; |
| 20 | using ThriftTest; |
| 21 | |
| 22 | namespace Client |
| 23 | { |
| 24 | public class Program |
| 25 | { |
| 26 | public static int Main(string[] args) |
| 27 | { |
| 28 | try |
| 29 | { |
| 30 | Console.SetBufferSize(Console.BufferWidth, 4096); |
| 31 | } |
| 32 | catch (Exception) |
| 33 | { |
| 34 | Console.WriteLine("Failed to grow scroll-back buffer"); |
| 35 | } |
| 36 | |
| 37 | // split mode and options |
| 38 | var subArgs = new List<string>(args); |
| 39 | var firstArg = string.Empty; |
| 40 | if (subArgs.Count > 0) |
| 41 | { |
| 42 | firstArg = subArgs[0]; |
| 43 | subArgs.RemoveAt(0); |
| 44 | } |
| 45 | |
| 46 | // run whatever mode is choosen |
| 47 | switch(firstArg) |
| 48 | { |
| 49 | case "client": |
Jens Geyer | ec43954 | 2019-11-01 19:19:44 +0100 | [diff] [blame^] | 50 | Console.WriteLine("The 'client' argument is no longer required."); |
| 51 | PrintHelp(); |
| 52 | return -1; |
| 53 | case "--performance-test": |
Jens Geyer | 5a17b13 | 2019-05-26 15:53:37 +0200 | [diff] [blame] | 54 | return Tests.PerformanceTests.Execute(); |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 55 | case "--help": |
| 56 | PrintHelp(); |
| 57 | return 0; |
| 58 | default: |
Jens Geyer | ec43954 | 2019-11-01 19:19:44 +0100 | [diff] [blame^] | 59 | return TestClient.Execute(subArgs); |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 60 | } |
| 61 | } |
| 62 | |
| 63 | private static void PrintHelp() |
| 64 | { |
| 65 | Console.WriteLine("Usage:"); |
Jens Geyer | ec43954 | 2019-11-01 19:19:44 +0100 | [diff] [blame^] | 66 | Console.WriteLine(" Client [options]"); |
| 67 | Console.WriteLine(" Client --performance-test"); |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 68 | Console.WriteLine(" Client --help"); |
| 69 | Console.WriteLine(""); |
| 70 | |
| 71 | TestClient.PrintOptionsHelp(); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | |