aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-09-18 12:21:07 +0200
committerDan Engelbrecht <[email protected]>2024-09-18 12:21:53 +0200
commit6db299f0f97e78b3da38bc35d97bc86a88062d8a (patch)
treeb8f51bff9ca9f1a620541e2dc654ce422ef70635
parentcache generate command to create large data sets for testing (#159) (diff)
downloadzen-de/improve-status-command.tar.xz
zen-de/improve-status-command.zip
clean up name/description of up, attach, down and status commandsde/improve-status-command
-rw-r--r--src/zen/cmds/status_cmd.h5
-rw-r--r--src/zen/cmds/up_cmd.h15
-rw-r--r--src/zen/zen.cpp8
3 files changed, 20 insertions, 8 deletions
diff --git a/src/zen/cmds/status_cmd.h b/src/zen/cmds/status_cmd.h
index 2dc742944..382b8e597 100644
--- a/src/zen/cmds/status_cmd.h
+++ b/src/zen/cmds/status_cmd.h
@@ -11,6 +11,9 @@ namespace zen {
class StatusCommand : public ZenCmdBase
{
public:
+ static constexpr char Name[] = "status";
+ static constexpr char Description[] = "Show zen status";
+
StatusCommand();
~StatusCommand();
@@ -20,7 +23,7 @@ public:
private:
int GetLockFileEffectivePort() const;
- cxxopts::Options m_Options{"status", "Show zen status"};
+ cxxopts::Options m_Options{Name, Description};
uint16_t m_Port;
std::filesystem::path m_DataDir;
};
diff --git a/src/zen/cmds/up_cmd.h b/src/zen/cmds/up_cmd.h
index 94f896b4e..878228551 100644
--- a/src/zen/cmds/up_cmd.h
+++ b/src/zen/cmds/up_cmd.h
@@ -11,6 +11,9 @@ namespace zen {
class UpCommand : public ZenCmdBase
{
public:
+ static constexpr char Name[] = "up";
+ static constexpr char Description[] = "Bring up zen service";
+
UpCommand();
~UpCommand();
@@ -18,7 +21,7 @@ public:
virtual cxxopts::Options& Options() override { return m_Options; }
private:
- cxxopts::Options m_Options{"up", "Bring up zen service"};
+ cxxopts::Options m_Options{Name, Description};
uint16_t m_Port = 0;
bool m_ShowConsole = false;
bool m_ShowLog = false;
@@ -28,6 +31,9 @@ private:
class AttachCommand : public ZenCmdBase
{
public:
+ static constexpr char Name[] = "attach";
+ static constexpr char Description[] = "Add a sponsor process to a running zen service";
+
AttachCommand();
~AttachCommand();
@@ -35,7 +41,7 @@ public:
virtual cxxopts::Options& Options() override { return m_Options; }
private:
- cxxopts::Options m_Options{"attach", "Add a sponsor process to a running zen service"};
+ cxxopts::Options m_Options{Name, Description};
uint16_t m_Port;
int m_OwnerPid;
std::filesystem::path m_DataDir;
@@ -44,6 +50,9 @@ private:
class DownCommand : public ZenCmdBase
{
public:
+ static constexpr char Name[] = "down";
+ static constexpr char Description[] = "Bring down zen service";
+
DownCommand();
~DownCommand();
@@ -51,7 +60,7 @@ public:
virtual cxxopts::Options& Options() override { return m_Options; }
private:
- cxxopts::Options m_Options{"down", "Bring down zen service"};
+ cxxopts::Options m_Options{Name, Description};
uint16_t m_Port;
bool m_ForceTerminate = false;
std::filesystem::path m_ProgramBaseDir;
diff --git a/src/zen/zen.cpp b/src/zen/zen.cpp
index 79338f6f3..d6ff3ee2e 100644
--- a/src/zen/zen.cpp
+++ b/src/zen/zen.cpp
@@ -340,7 +340,7 @@ main(int argc, char** argv)
const char* CmdSummary;
} Commands[] = {
// clang-format off
- {"attach", &AttachCmd, "Add a sponsor process to a running zen service"},
+ {AttachCommand::Name, &AttachCmd, AttachCommand::Description},
{"bench", &BenchCmd, "Utility command for benchmarking"},
{"cache-details", &CacheDetailsCmd, "Details on cache"},
{"cache-info", &CacheInfoCmd, "Info on cache, namespace or bucket"},
@@ -349,7 +349,7 @@ main(int argc, char** argv)
{"copy", &CopyCmd, "Copy file(s)"},
{"copy-state", &CopyStateCmd, "Copy zen server disk state"},
{"dedup", &DedupCmd, "Dedup files"},
- {"down", &DownCmd, "Bring zen server down"},
+ {DownCommand::Name, &DownCmd, DownCommand::Description},
{"drop", &DropCmd, "Drop cache namespace or bucket"},
{"gc-status", &GcStatusCmd, "Garbage collect zen storage status check"},
{"gc-stop", &GcStopCmd, "Request cancel of running garbage collection in zen storage"},
@@ -376,10 +376,10 @@ main(int argc, char** argv)
{"run", &RunCmd, "Run command with special options"},
{"scrub", &ScrubCmd, "Scrub zen storage (verify data integrity)"},
{"serve", &ServeCmd, "Serve files from a directory"},
- {"status", &StatusCmd, "Show zen status"},
+ {StatusCommand::Name, &StatusCmd, StatusCommand::Description},
{"top", &TopCmd, "Monitor zen server activity"},
{"trace", &TraceCmd, "Control zen realtime tracing"},
- {"up", &UpCmd, "Bring zen server up"},
+ {UpCommand::Name, &UpCmd, UpCommand::Description},
{"version", &VersionCmd, "Get zen server version"},
{"vfs", &VfsCmd, "Manage virtual file system"},
{"flush", &FlushCmd, "Flush storage"},