aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/util/color.h6
-rw-r--r--src/command/cd.cc9
-rw-r--r--src/util/color.cc4
3 files changed, 5 insertions, 14 deletions
diff --git a/include/util/color.h b/include/util/color.h
index 01711d6..707efb4 100644
--- a/include/util/color.h
+++ b/include/util/color.h
@@ -5,14 +5,14 @@
namespace ov4
{
-std::string make_color(const std::string s, const std::string color);
+std::string make_color(const std::string s, const std::string_view color);
}
namespace ov4::color
{
-const std::string
+constexpr std::string_view
black = "30",
red = "31",
green = "32",
@@ -22,7 +22,7 @@ const std::string
cyan = "36",
white = "37";
-const std::string
+constexpr std::string_view
bright_black = "90",
bright_red = "91",
bright_green = "92",
diff --git a/src/command/cd.cc b/src/command/cd.cc
index 5434f20..ecc511c 100644
--- a/src/command/cd.cc
+++ b/src/command/cd.cc
@@ -5,15 +5,6 @@
using namespace std;
-// constexpr string_view
-// err_EACCES = "cd: Search permission is denied for one of the components of path.",
-// err_EFAULT = "cd: path points outside your accessible address space.",
-// err_EIO = "An I/O error occurred.",
-// err_ENOTDIR = "A component of path is not a directory.",
-// err_ENOENT = "The directory specified in path does not exist.",
-// err_ENAMETOOLONG = "path is too long.",
-// err_ENOMEM = "Insufficient kernel memory was available.";
-
const unordered_map<int, string_view> err_list = {
{ EACCES, "cd: Search permission is denied for one of the components of path." },
{ EFAULT, "cd: path points outside your accessible address space." },
diff --git a/src/util/color.cc b/src/util/color.cc
index 87fd346..2721f38 100644
--- a/src/util/color.cc
+++ b/src/util/color.cc
@@ -9,9 +9,9 @@ using namespace std;
namespace ov4
{
-string make_color(const string s, const string color)
+string make_color(const string s, const string_view color)
{
- return "\e[0;" + color + "m" + s + "\e[0m";
+ return "\e[0;" + (string)color + "m" + s + "\e[0m";
}
}