-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
339 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#include "Command.hpp" | ||
#include "../Utils/General.hpp" | ||
namespace Command{ | ||
bool getServerName(std::string& name){ | ||
std::cout << "Enter the name of the server: "; | ||
std::getline(std::cin, name); | ||
return true; | ||
} | ||
bool getServerAddress(std::string& address){ | ||
std::cout << "Enter the address of the server: "; | ||
std::getline(std::cin, address); | ||
return true; | ||
} | ||
bool getServerPort(std::string& port){ | ||
std::cout << "Enter the port of the server: "; | ||
std::getline(std::cin, port); | ||
return true; | ||
} | ||
bool getServerUsername(std::string& username){ | ||
std::cout << "Enter the username of the server: "; | ||
std::getline(std::cin, username); | ||
return true; | ||
} | ||
bool getServerAuthMethod(std::string& authMethod){ | ||
std::cout << "Enter the authentication method of the server: "; | ||
std::getline(std::cin, authMethod); | ||
return true; | ||
} | ||
bool getServerPassword(std::string& password){ | ||
std::cout << "Enter the password of the server: "; | ||
std::getline(std::cin, password); | ||
return true; | ||
} | ||
bool getServerKey(std::string& key){ | ||
std::cout << "Enter path the ssh key for the server: "; | ||
std::getline(std::cin, key); | ||
return true; | ||
} | ||
|
||
bool serverHelp(){ | ||
|
||
std::cout << R"EOF( | ||
Usage server: | ||
add: adds a build server | ||
remove: removes a build server | ||
list: lists all build servers | ||
set: sets the current build server | ||
get: gets the current build server | ||
)EOF" << std::endl; | ||
return true; | ||
} | ||
bool serverAdd(Interface* inter){ | ||
std::string name, address, port, username, authMethod, password, key; | ||
getServerName(name); | ||
getServerAddress(address); | ||
getServerPort(port); | ||
getServerUsername(username); | ||
getServerAuthMethod(authMethod); | ||
if (authMethod == "password") { | ||
getServerPassword(password); | ||
} | ||
else if (authMethod == "key") { | ||
getServerKey(key); | ||
} | ||
else{ | ||
std::cout << "Invalid authentication method" << std::endl; | ||
return false; | ||
} | ||
inter->ctx->build_servers.push_back(BuildServer(name, address, port, username, authMethod, password, key)); | ||
return true; | ||
} | ||
bool Interface::server(){ | ||
|
||
if (this->args->count("subcommand") == 0) { | ||
serverHelp(); | ||
|
||
return false; | ||
} | ||
if (this->args->operator[]("subcommand").as<std::string>() == "add") { | ||
serverAdd(this); | ||
} | ||
else if (this->args->operator[]("subcommand").as<std::string>() == "remove") { | ||
} | ||
else if (this->args->operator[]("subcommand").as<std::string>() == "list") { | ||
} | ||
else if (this->args->operator[]("subcommand").as<std::string>() == "set") { | ||
} | ||
else if (this->args->operator[]("subcommand").as<std::string>() == "get") { | ||
} | ||
else{ | ||
serverHelp(); | ||
|
||
return false; | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.