Changed devel_commitinfo to buildinfo
Also, the command is now `-B' instead of `devel commitinfo'master
parent
2be92c75e7
commit
0af3364fcf
46
src/ceev.cc
46
src/ceev.cc
|
@ -1,5 +1,6 @@
|
|||
#include "ceev.h"
|
||||
int usage() {
|
||||
|
||||
static int usage() {
|
||||
std::cout << "Usage:";
|
||||
std::cout << "\n\t";
|
||||
std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <"
|
||||
|
@ -11,7 +12,7 @@ int usage() {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int show_help() {
|
||||
static int show_help() {
|
||||
std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <"
|
||||
<< bright_green("options") << ">\n";
|
||||
std::cout << "\n";
|
||||
|
@ -57,11 +58,24 @@ int show_help() {
|
|||
<< "\n";
|
||||
std::cout << "\t\t";
|
||||
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;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int show_version() {
|
||||
int buildinfo() {
|
||||
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"))
|
||||
|
@ -165,10 +179,12 @@ int create_fs(std::deque<std::string> args) {
|
|||
config.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int build_project(std::deque<std::string> args) {
|
||||
std::cout << "Building project..." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int run_project(std::deque<std::string> args) {
|
||||
struct config_data data = get_config();
|
||||
std::cout << "Name: " << data.name << '\n';
|
||||
|
@ -178,10 +194,12 @@ int run_project(std::deque<std::string> args) {
|
|||
std::cout << "Running project..." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int clean_project(std::deque<std::string> args) {
|
||||
std::cout << "Cleaning project..." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int devel(std::deque<std::string> args) {
|
||||
if (args.empty()) {
|
||||
std::cout << bg_red(bold("ERROR")) << ": No subcommands given."
|
||||
|
@ -191,8 +209,6 @@ int devel(std::deque<std::string> args) {
|
|||
}
|
||||
std::string a1 = args[0];
|
||||
args.pop_front();
|
||||
if (a1 == "commitinfo")
|
||||
return devel_commitinfo();
|
||||
if (a1 == "roadmap")
|
||||
return devel_roadmap();
|
||||
if (a1 == "sdl2")
|
||||
|
@ -217,6 +233,7 @@ int devel(std::deque<std::string> args) {
|
|||
devel_help();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int devel_help() {
|
||||
std::cout << "Usage:";
|
||||
// ceev devel roadmap
|
||||
|
@ -224,11 +241,6 @@ int devel_help() {
|
|||
std::cout << GET_PROGRAM_NAME() << " devel " << cyan("roadmap") << "\n";
|
||||
std::cout << "\t\t";
|
||||
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
|
||||
std::cout << "\n*\t";
|
||||
std::cout << GET_PROGRAM_NAME() << " devel " << cyan("sdl2") << " <"
|
||||
|
@ -245,12 +257,7 @@ int devel_help() {
|
|||
std::cout << std::endl;
|
||||
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() {
|
||||
std::cout << "CeeV roadmap:\n";
|
||||
std::cout << "*" << bg_bright_green("INPROG")
|
||||
|
@ -320,6 +327,7 @@ int devel_sdl2(std::deque<std::string> args) {
|
|||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc <= 1) {
|
||||
return usage();
|
||||
|
@ -329,9 +337,8 @@ int main(int argc, char **argv) {
|
|||
args.push_back(std::string(argv[i]));
|
||||
std::string a1 = std::string(args[0]);
|
||||
args.pop_front();
|
||||
if (a1 == "init") {
|
||||
if (a1 == "init")
|
||||
return create_fs(args);
|
||||
}
|
||||
if (a1 == "build")
|
||||
return build_project(args);
|
||||
if (a1 == "run")
|
||||
|
@ -354,6 +361,9 @@ int main(int argc, char **argv) {
|
|||
return show_version();
|
||||
if (kw == "h")
|
||||
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 `"
|
||||
<< bright_magenta(a1) << "'\n"
|
||||
|
|
|
@ -42,8 +42,9 @@ struct config_data {
|
|||
std::string author = "";
|
||||
std::string email = "";
|
||||
};
|
||||
int usage();
|
||||
int show_help();
|
||||
static int usage();
|
||||
static int show_help();
|
||||
static int buildinfo();
|
||||
bool replace(std::string& str, const std::string& from, const std::string& to);
|
||||
static std::string query_author();
|
||||
int create_fs(std::deque<std::string> args);
|
||||
|
@ -52,7 +53,6 @@ int run_project(std::deque<std::string> args);
|
|||
int clean_project(std::deque<std::string> args);
|
||||
int devel(std::deque<std::string> args);
|
||||
int devel_help();
|
||||
int devel_commitinfo();
|
||||
int devel_roadmap();
|
||||
int devel_sdl2(std::deque<std::string> args);
|
||||
int main(int argc, char **argv);
|
||||
|
|
Loading…
Reference in New Issue