diff --git a/src/ceev.cc b/src/ceev.cc index 9309b78..a9397b0 100644 --- a/src/ceev.cc +++ b/src/ceev.cc @@ -3,41 +3,41 @@ int usage() { std::cout << "Usage:"; std::cout << "\n\t"; - std::cout << program_invocation_short_name << " [" << cyan("command") << "] <" << bright_green("options") << ">\n"; + std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <" << bright_green("options") << ">\n"; std::cout << "\n"; - std::cout << "Run `" << program_invocation_short_name << bright_green(" --help") << "' for more information.\n" << std::endl; + std::cout << "Run `" << GET_PROGRAM_NAME() << bright_green(" --help") << "' for more information.\n" << std::endl; return 1; } int show_help() { - std::cout << program_invocation_short_name << " [" << cyan("command") << "] <" << bright_green("options") << ">\n"; + std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <" << bright_green("options") << ">\n"; std::cout << "\n"; std::cout << "Usage:"; // ceev init std::cout << "\n*\t"; - std::cout << program_invocation_short_name << cyan(" init ") << "<" << bright_green("--force") << ">\n"; + std::cout << GET_PROGRAM_NAME() << cyan(" init ") << "<" << bright_green("--force") << ">\n"; std::cout << "\t\t"; std::cout << "Creates the CeeV file system. Can only be used "; std::cout << "if the current folder is empty,"; std::cout << "\n\t\tor when run with `" << bright_green("--force") << "'"; // ceev build std::cout << "\n*\t"; - std::cout << program_invocation_short_name << cyan(" build") << "\n"; + std::cout << GET_PROGRAM_NAME() << cyan(" build") << "\n"; std::cout << "\t\t"; std::cout << "Not yet implemented"; // ceev run std::cout << "\n*\t"; - std::cout << program_invocation_short_name << cyan(" run") << "\n"; + std::cout << GET_PROGRAM_NAME() << cyan(" run") << "\n"; std::cout << "\t\t"; std::cout << "Not yet implemented"; // ceev clean std::cout << "\n*\t"; - std::cout << program_invocation_short_name << cyan(" clean") << "\n"; + std::cout << GET_PROGRAM_NAME() << cyan(" clean") << "\n"; std::cout << "\t\t"; std::cout << "Not yet implemented"; // ceev --help std::cout << "\n*\t"; - std::cout << program_invocation_short_name << cyan(" --help") << "\n"; + std::cout << GET_PROGRAM_NAME() << cyan(" --help") << "\n"; std::cout << "\t\t"; std::cout << "This help page.\n"; std::cout << std::endl; diff --git a/src/ceev.h b/src/ceev.h index 23839de..4645959 100644 --- a/src/ceev.h +++ b/src/ceev.h @@ -2,13 +2,22 @@ #include #include +#include #include #include #include -#include +#include #include "colors.h" +#undef GET_PROGRAM_NAME +#ifdef __GLIBC__ +#define GET_PROGRAM_NAME() program_invocation_short_name +#else +#include +#define GET_PROGRAM_NAME() getprogname() +#endif + namespace fs = std::filesystem; struct config_data { diff --git a/src/colors.cc b/src/colors.cc index b73106e..14616db 100644 --- a/src/colors.cc +++ b/src/colors.cc @@ -1,75 +1,37 @@ #include "colors.h" -void colors_test() { - std::cout << "Hello World"; -} - std::string black(std::string input) {return "\x1b[30m" + input + "\x1b[0m";} - std::string red(std::string input) {return "\x1b[31m" + input + "\x1b[0m";} - std::string green(std::string input) {return "\x1b[32m" + input + "\x1b[0m";} - std::string yellow(std::string input) {return "\x1b[33m" + input + "\x1b[0m";} - std::string blue(std::string input) {return "\x1b[34m" + input + "\x1b[0m";} - std::string magenta(std::string input) {return "\x1b[35m" + input + "\x1b[0m";} - std::string cyan(std::string input) {return "\x1b[36m" + input + "\x1b[0m";} - std::string white(std::string input) {return "\x1b[37m" + input + "\x1b[0m";} - std::string bright_black(std::string input) {return "\x1b[90m" + input + "\x1b[0m";} - std::string bright_red(std::string input) {return "\x1b[91m" + input + "\x1b[0m";} - std::string bright_green(std::string input) {return "\x1b[92m" + input + "\x1b[0m";} - std::string bright_yellow(std::string input) {return "\x1b[93m" + input + "\x1b[0m";} - std::string bright_blue(std::string input) {return "\x1b[94m" + input + "\x1b[0m";} - std::string bright_magenta(std::string input) {return "\x1b[95m" + input + "\x1b[0m";} - std::string bright_cyan(std::string input) {return "\x1b[96m" + input + "\x1b[0m";} - std::string bright_white(std::string input) {return "\x1b[97m" + input + "\x1b[0m";} - std::string bg_black(std::string input) {return "\x1b[40m" + input + "\x1b[0m";} - std::string bg_red(std::string input) {return "\x1b[41m" + input + "\x1b[0m";} - std::string bg_green(std::string input) {return "\x1b[42m" + input + "\x1b[0m";} - std::string bg_yellow(std::string input) {return "\x1b[43m" + input + "\x1b[0m";} - std::string bg_blue(std::string input) {return "\x1b[44m" + input + "\x1b[0m";} - std::string bg_magenta(std::string input) {return "\x1b[45m" + input + "\x1b[0m";} - std::string bg_cyan(std::string input) {return "\x1b[46m" + input + "\x1b[0m";} - std::string bg_white(std::string input) {return "\x1b[47m" + input + "\x1b[0m";} - std::string bg_bright_black(std::string input) {return "\x1b[100m" + input + "\x1b[0m";} - std::string bg_bright_red(std::string input) {return "\x1b[101m" + input + "\x1b[0m";} - std::string bg_bright_green(std::string input) {return "\x1b[102m" + input + "\x1b[0m";} - std::string bg_bright_yellow(std::string input) {return "\x1b[103m" + input + "\x1b[0m";} - std::string bg_bright_blue(std::string input) {return "\x1b[104m" + input + "\x1b[0m";} - std::string bg_bright_magenta(std::string input) {return "\x1b[105m" + input + "\x1b[0m";} - std::string bg_bright_cyan(std::string input) {return "\x1b[106m" + input + "\x1b[0m";} - std::string bg_bright_white(std::string input) {return "\x1b[107m" + input + "\x1b[0m";} - std::string bold(std::string input) {return "\x1b[1m" + input + "\x1b[0m";} - std::string underline(std::string input) {return "\x1b[4m" + input + "\x1b[0m";} - std::string reverse(std::string input) {return "\x1b[7m" + input + "\x1b[0m";} \ No newline at end of file diff --git a/src/colors.h b/src/colors.h index 173e5c2..d177240 100644 --- a/src/colors.h +++ b/src/colors.h @@ -1,9 +1,7 @@ #pragma once -#include #include -void colors_test(); std::string black(std::string input); std::string red(std::string input); std::string green(std::string input);