Compare commits

..

No commits in common. "0af3364fcfc3160370dad24e22e1594d9c2711bf" and "d5c5c042fce1e3b414c2a05eae171e49930bff5b" have entirely different histories.

2 changed files with 22 additions and 38 deletions

View File

@ -1,6 +1,5 @@
#include "ceev.h" #include "ceev.h"
int usage() {
static int usage() {
std::cout << "Usage:"; std::cout << "Usage:";
std::cout << "\n\t"; std::cout << "\n\t";
std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <" std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <"
@ -12,7 +11,7 @@ static int usage() {
return 1; return 1;
} }
static int show_help() { int show_help() {
std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <" std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <"
<< bright_green("options") << ">\n"; << bright_green("options") << ">\n";
std::cout << "\n"; std::cout << "\n";
@ -58,30 +57,11 @@ static int show_help() {
<< "\n"; << "\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "Get the current version."; std::cout << "Get the current version.";
// ceev --build
std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << cyan(" --build") << "/" << cyan("-B")
<< "\n";
std::cout << "\t\t";
std::cout << "Get the current build information.";
std::cout << std::endl; std::cout << std::endl;
return 0; return 0;
} }
int buildinfo() { int show_version() {
std::cout << "CeeV build " << bright_cyan(bold(GIT_COMMIT_HASH)) << "\n\n";
std::cout << "Commit message:\n";
std::cout << bright_cyan(bold(GIT_COMMIT_MSG)) << std::endl;
return 0;
}
static int show_version() {
char buf[6];
std::memcpy(buf, &__ceev_version[std::strlen(__ceev_version) - 5], 6);
if (!std::strcmp(buf, "devel"))
std::cout << "CeeV version " << __ceev_version << " (Build "
<< GIT_COMMIT_HASH << ")" << '\n';
else
std::cout << "CeeV version " << __ceev_version << '\n'; std::cout << "CeeV version " << __ceev_version << '\n';
return 0; return 0;
} }
@ -179,12 +159,10 @@ int create_fs(std::deque<std::string> args) {
config.close(); config.close();
return 0; return 0;
} }
int build_project(std::deque<std::string> args) { int build_project(std::deque<std::string> args) {
std::cout << "Building project..." << std::endl; std::cout << "Building project..." << std::endl;
return 0; return 0;
} }
int run_project(std::deque<std::string> args) { int run_project(std::deque<std::string> args) {
struct config_data data = get_config(); struct config_data data = get_config();
std::cout << "Name: " << data.name << '\n'; std::cout << "Name: " << data.name << '\n';
@ -194,12 +172,10 @@ int run_project(std::deque<std::string> args) {
std::cout << "Running project..." << std::endl; std::cout << "Running project..." << std::endl;
return 0; return 0;
} }
int clean_project(std::deque<std::string> args) { int clean_project(std::deque<std::string> args) {
std::cout << "Cleaning project..." << std::endl; std::cout << "Cleaning project..." << std::endl;
return 0; return 0;
} }
int devel(std::deque<std::string> args) { int devel(std::deque<std::string> args) {
if (args.empty()) { if (args.empty()) {
std::cout << bg_red(bold("ERROR")) << ": No subcommands given." std::cout << bg_red(bold("ERROR")) << ": No subcommands given."
@ -209,6 +185,8 @@ int devel(std::deque<std::string> args) {
} }
std::string a1 = args[0]; std::string a1 = args[0];
args.pop_front(); args.pop_front();
if (a1 == "commitinfo")
return devel_commitinfo();
if (a1 == "roadmap") if (a1 == "roadmap")
return devel_roadmap(); return devel_roadmap();
if (a1 == "sdl2") if (a1 == "sdl2")
@ -233,7 +211,6 @@ int devel(std::deque<std::string> args) {
devel_help(); devel_help();
return 1; return 1;
} }
int devel_help() { int devel_help() {
std::cout << "Usage:"; std::cout << "Usage:";
// ceev devel roadmap // ceev devel roadmap
@ -241,6 +218,11 @@ int devel_help() {
std::cout << GET_PROGRAM_NAME() << " devel " << cyan("roadmap") << "\n"; std::cout << GET_PROGRAM_NAME() << " devel " << cyan("roadmap") << "\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "Get the current roadmap."; std::cout << "Get the current roadmap.";
// ceev devel commitinfo
std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << " devel " << cyan("commitinfo") << "\n";
std::cout << "\t\t";
std::cout << "Get info about the latest commit.";
// ceev devel sdl2 // ceev devel sdl2
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << " devel " << cyan("sdl2") << " <" std::cout << GET_PROGRAM_NAME() << " devel " << cyan("sdl2") << " <"
@ -257,7 +239,12 @@ int devel_help() {
std::cout << std::endl; std::cout << std::endl;
return 0; return 0;
} }
int devel_commitinfo() {
std::cout << "CeeV build " << bright_cyan(bold(GIT_COMMIT_HASH)) << "\n\n";
std::cout << "Commit message:\n";
std::cout << bright_cyan(bold(GIT_COMMIT_MSG)) << std::endl;
return 0;
}
int devel_roadmap() { int devel_roadmap() {
std::cout << "CeeV roadmap:\n"; std::cout << "CeeV roadmap:\n";
std::cout << "*" << bg_bright_green("INPROG") std::cout << "*" << bg_bright_green("INPROG")
@ -327,7 +314,6 @@ int devel_sdl2(std::deque<std::string> args) {
SDL_Quit(); SDL_Quit();
return 0; return 0;
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
if (argc <= 1) { if (argc <= 1) {
return usage(); return usage();
@ -337,8 +323,9 @@ int main(int argc, char **argv) {
args.push_back(std::string(argv[i])); args.push_back(std::string(argv[i]));
std::string a1 = std::string(args[0]); std::string a1 = std::string(args[0]);
args.pop_front(); args.pop_front();
if (a1 == "init") if (a1 == "init") {
return create_fs(args); return create_fs(args);
}
if (a1 == "build") if (a1 == "build")
return build_project(args); return build_project(args);
if (a1 == "run") if (a1 == "run")
@ -361,9 +348,6 @@ int main(int argc, char **argv) {
return show_version(); return show_version();
if (kw == "h") if (kw == "h")
return show_help(); return show_help();
// XXX: for now, use devel. maybe change this in the future?
if (kw == "B")
return buildinfo();
} }
std::cerr << bg_red(bold("ERROR")) << ": Unknown command `" std::cerr << bg_red(bold("ERROR")) << ": Unknown command `"
<< bright_magenta(a1) << "'\n" << bright_magenta(a1) << "'\n"

View File

@ -42,9 +42,8 @@ struct config_data {
std::string author = ""; std::string author = "";
std::string email = ""; std::string email = "";
}; };
static int usage(); int usage();
static int show_help(); int show_help();
static int buildinfo();
bool replace(std::string& str, const std::string& from, const std::string& to); bool replace(std::string& str, const std::string& from, const std::string& to);
static std::string query_author(); static std::string query_author();
int create_fs(std::deque<std::string> args); int create_fs(std::deque<std::string> args);
@ -53,6 +52,7 @@ int run_project(std::deque<std::string> args);
int clean_project(std::deque<std::string> args); int clean_project(std::deque<std::string> args);
int devel(std::deque<std::string> args); int devel(std::deque<std::string> args);
int devel_help(); int devel_help();
int devel_commitinfo();
int devel_roadmap(); int devel_roadmap();
int devel_sdl2(std::deque<std::string> args); int devel_sdl2(std::deque<std::string> args);
int main(int argc, char **argv); int main(int argc, char **argv);