static void Main(string[] args) { TpConfigReaderWriter tpConfigReader = new TpConfigReaderWriter(); TpConfig tpConfig = tpConfigReader.TpConfig; if (String.IsNullOrEmpty(tpConfig.Origin)) { Console.WriteLine("Please use 'tp connect' to connect to an origin."); return; } if (args.Length == 0) { Console.WriteLine("Please provide a command"); return; } Cli cli = new Cli(tpConfig); cli.ParseAndRun(args).Wait(); }
public async Task SetActive(string[] args) { string projectName = args[1]; HttpResponseMessage message = await _client.GetAsync(_tpConfig.Origin + "/api/project/" + WebUtility.UrlEncode(projectName)); if (message.StatusCode == HttpStatusCode.NotFound) { Console.WriteLine("Cannot activate project '{0}' as it does not exist!", projectName); } else if (message.StatusCode == HttpStatusCode.OK) { _tpConfig.ActiveProject = projectName; TpConfigReaderWriter tpConfigReaderWriter = new TpConfigReaderWriter(); tpConfigReaderWriter.TpConfig = _tpConfig; await tpConfigReaderWriter.WriteConfig(); Console.WriteLine("Active project set to '{0}'", projectName); } else { Console.WriteLine("Error: {0}", message.StatusCode.ToString()); } }