aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-10-03 17:15:58 +0200
committerGitHub Enterprise <[email protected]>2024-10-03 17:15:58 +0200
commit47e27cbe2aa1e1d6eff28f8f46f92044614f909c (patch)
treedcd4d23311ba1264ae39af8f494afff3f10e7b55 /src
parentremove gc v1 (#121) (diff)
downloadzen-47e27cbe2aa1e1d6eff28f8f46f92044614f909c.tar.xz
zen-47e27cbe2aa1e1d6eff28f8f46f92044614f909c.zip
improve naming and feedback in zen commands (#185)
* rename cache-get opton attachmentid -> attachmenthash for improved clarity * add help info for --dry-run in DropProjectCommand
Diffstat (limited to 'src')
-rw-r--r--src/zen/cmds/cache_cmd.cpp22
-rw-r--r--src/zen/cmds/cache_cmd.h2
-rw-r--r--src/zen/cmds/projectstore_cmd.cpp7
3 files changed, 18 insertions, 13 deletions
diff --git a/src/zen/cmds/cache_cmd.cpp b/src/zen/cmds/cache_cmd.cpp
index d6fec3b12..bf5f308e1 100644
--- a/src/zen/cmds/cache_cmd.cpp
+++ b/src/zen/cmds/cache_cmd.cpp
@@ -525,14 +525,14 @@ CacheGetCommand::CacheGetCommand()
m_Options.add_option("", "v", "valuekey", "Cache entry iohash id", cxxopts::value(m_ValueKey), "<valuekey>");
m_Options.add_option("",
"a",
- "attachmentid",
- "For a cache entry record, get a particular attachment based on IoHash",
- cxxopts::value(m_AttachmentId),
- "<attachmentid>");
+ "attachmenthash",
+ "For a cache entry record, get a particular attachment based on the 'RawHash'",
+ cxxopts::value(m_AttachmentHash),
+ "<attachmenthash>");
m_Options.add_option("", "o", "output-path", "File path for output data", cxxopts::value(m_OutputPath), "<path>");
m_Options.add_option("", "t", "text", "Ouput content of cache entry record as text", cxxopts::value(m_AsText), "<text>");
- m_Options.parse_positional({"namespace", "bucket", "valuekey", "attachmentid"});
- m_Options.positional_help("namespace bucket valuekey attachmentid");
+ m_Options.parse_positional({"namespace", "bucket", "valuekey", "attachmenthash"});
+ m_Options.positional_help("namespace bucket valuekey attachmenthash");
}
CacheGetCommand::~CacheGetCommand() = default;
@@ -578,11 +578,11 @@ CacheGetCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
}
IoHash AttachmentHash;
- if (!m_AttachmentId.empty())
+ if (!m_AttachmentHash.empty())
{
- if (!IoHash::TryParse(m_AttachmentId, AttachmentHash))
+ if (!IoHash::TryParse(m_AttachmentHash, AttachmentHash))
{
- throw zen::OptionParseException("cache-get --attachmentid option requires a valid IoHash string");
+ throw zen::OptionParseException("cache-get --attachmenthash option requires a valid IoHash string");
}
}
@@ -594,7 +594,7 @@ CacheGetCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
TargetPath = std::filesystem::path(m_OutputPath);
if (std::filesystem::is_directory(TargetPath))
{
- TargetPath = TargetPath / (m_AttachmentId.empty() ? m_ValueKey : m_AttachmentId);
+ TargetPath = TargetPath / (m_AttachmentHash.empty() ? m_ValueKey : m_AttachmentHash);
}
else
{
@@ -603,7 +603,7 @@ CacheGetCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
}
if (TargetPath.empty())
{
- TargetPath = (m_AttachmentId.empty() ? m_ValueKey : m_AttachmentId);
+ TargetPath = (m_AttachmentHash.empty() ? m_ValueKey : m_AttachmentHash);
}
std::string Url = fmt::format("/z$/{}/{}/{}", m_Namespace, m_Bucket, m_ValueKey);
diff --git a/src/zen/cmds/cache_cmd.h b/src/zen/cmds/cache_cmd.h
index c3184140a..225665680 100644
--- a/src/zen/cmds/cache_cmd.h
+++ b/src/zen/cmds/cache_cmd.h
@@ -111,7 +111,7 @@ private:
std::string m_Namespace;
std::string m_Bucket;
std::string m_ValueKey;
- std::string m_AttachmentId;
+ std::string m_AttachmentHash;
std::string m_OutputPath;
bool m_AsText = false;
};
diff --git a/src/zen/cmds/projectstore_cmd.cpp b/src/zen/cmds/projectstore_cmd.cpp
index 55e5299e3..50f6b3633 100644
--- a/src/zen/cmds/projectstore_cmd.cpp
+++ b/src/zen/cmds/projectstore_cmd.cpp
@@ -452,7 +452,12 @@ DropProjectCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** arg
{
return 1;
}
- ZEN_CONSOLE("{} oplog '{}/{}' from '{}'", m_DryRun ? "Would drop" : "Dropping", m_ProjectName, m_OplogName, m_HostName);
+ ZEN_CONSOLE("{} oplog '{}/{}' from '{}'{}",
+ m_DryRun ? "Would drop" : "Dropping",
+ m_ProjectName,
+ m_OplogName,
+ m_HostName,
+ m_DryRun ? ". Add --dryrun=false to execute the drop"sv : ""sv);
if (!m_DryRun)
{
if (HttpClient::Response Result = Http.Delete(fmt::format("/prj/{}/oplog/{}", m_ProjectName, m_OplogName)))