73 lines
1.1 KiB
C++
73 lines
1.1 KiB
C++
#include <iostream>
|
|
#include <vector>
|
|
|
|
/**
|
|
* Function prototypes
|
|
*/
|
|
int list(const std::string&);
|
|
int calibrate(const std::string&);
|
|
std::string retrieve_path();
|
|
void help_menu();
|
|
int install(const std::string&, const std::string&);
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
/**
|
|
* Paths
|
|
*/
|
|
const std::string hd = retrieve_path();
|
|
|
|
for (unsigned int i = 0; i < path.size(); i++)
|
|
{
|
|
path[i].insert(0, hd);
|
|
}
|
|
/**
|
|
* Turning char arguments to string
|
|
*/
|
|
std::vector<std::string> args(argv, argv + argc);
|
|
|
|
/**
|
|
* Argument handler
|
|
*/
|
|
if (args[1] == "help")
|
|
{
|
|
help_menu();
|
|
}
|
|
else if (args[1] == "calibrate")
|
|
{
|
|
return calibrate(hd);
|
|
}
|
|
else if (args[1] == "list")
|
|
{
|
|
return list(hd);
|
|
}
|
|
else if (args[1] == "install")
|
|
{
|
|
if (argc < 3) // TO DO
|
|
{
|
|
std::cerr << "Argument required!" << std::endl;
|
|
return 1;
|
|
}
|
|
|
|
else if (install(hd, args[2]))
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
else if (args[1] == "uninstall")
|
|
{
|
|
|
|
}
|
|
else if (args[1] == "query")
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
help_menu();
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|