diff options
| author | Dan Engelbrecht <[email protected]> | 2025-06-10 11:02:17 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-06-10 11:02:17 +0200 |
| commit | f1c6232d73d85870e35e508ba4330865218e63a4 (patch) | |
| tree | 392920b1a1334d61900b871b851228cd7963a46c /src | |
| parent | 5.6.11 (diff) | |
| download | zen-f1c6232d73d85870e35e508ba4330865218e63a4.tar.xz zen-f1c6232d73d85870e35e508ba4330865218e63a4.zip | |
Don't require `--namespace` option when using `zen list-namespaces` command (#429)
Diffstat (limited to 'src')
| -rw-r--r-- | src/zen/cmds/builds_cmd.cpp | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/src/zen/cmds/builds_cmd.cpp b/src/zen/cmds/builds_cmd.cpp index 133ff795d..abb4bfe0c 100644 --- a/src/zen/cmds/builds_cmd.cpp +++ b/src/zen/cmds/builds_cmd.cpp @@ -10056,7 +10056,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) }; ParseSystemOptions(); - auto ParseStorageOptions = [&](bool RequireBucket) { + auto ParseStorageOptions = [&](bool RequireNamespace, bool RequireBucket) { m_Host = RemoveQuotes(m_Host); m_OverrideHost = RemoveQuotes(m_OverrideHost); m_Url = RemoveQuotes(m_Url); @@ -10113,7 +10113,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) throw zen::OptionParseException( fmt::format("host/url/override-host is not compatible with the storage-path option\n{}", SubOption->help())); } - if (m_Namespace.empty()) + if (RequireNamespace && m_Namespace.empty()) { throw zen::OptionParseException(fmt::format("namespace option is required for this storage option\n{}", SubOption->help())); } @@ -10280,8 +10280,9 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) auto CreateBuildStorage = [&](BuildStorage::Statistics& StorageStats, BuildStorageCache::Statistics& StorageCacheStats, const std::filesystem::path& TempPath, + bool RequireNamespace, bool RequireBucket) -> StorageInstance { - ParseStorageOptions(RequireBucket); + ParseStorageOptions(RequireNamespace, RequireBucket); m_ZenCacheHost = RemoveQuotes(m_ZenCacheHost); @@ -10711,8 +10712,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) } }); - StorageInstance Storage = - CreateBuildStorage(StorageStats, StorageCacheStats, ZenTempFolderPath(ZenFolderPath), /*RequireBucket*/ false); + StorageInstance Storage = CreateBuildStorage(StorageStats, + StorageCacheStats, + ZenTempFolderPath(ZenFolderPath), + /*RequriesNamespace*/ false, + /*RequireBucket*/ false); CbObject Response = Storage.BuildStorage->ListNamespaces(m_ListNamespacesRecursive); ZEN_ASSERT(ValidateCompactBinary(Response.GetView(), CbValidateMode::All) == CbValidateError::None); @@ -10799,8 +10803,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) } }); - StorageInstance Storage = - CreateBuildStorage(StorageStats, StorageCacheStats, ZenTempFolderPath(m_ZenFolderPath), /*RequireBucket*/ false); + StorageInstance Storage = CreateBuildStorage(StorageStats, + StorageCacheStats, + ZenTempFolderPath(m_ZenFolderPath), + /*RequriesNamespace*/ true, + /*RequireBucket*/ false); CbObject Response = Storage.BuildStorage->ListBuilds(QueryObject); ZEN_ASSERT(ValidateCompactBinary(Response.GetView(), CbValidateMode::All) == CbValidateError::None); @@ -10854,8 +10861,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) } }); - StorageInstance Storage = - CreateBuildStorage(StorageStats, StorageCacheStats, ZenTempFolderPath(m_ZenFolderPath), /*RequireBucket*/ true); + StorageInstance Storage = CreateBuildStorage(StorageStats, + StorageCacheStats, + ZenTempFolderPath(m_ZenFolderPath), + /*RequriesNamespace*/ true, + /*RequireBucket*/ true); if (m_BuildPartName.empty()) { @@ -10934,8 +10944,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) BuildStorage::Statistics StorageStats; BuildStorageCache::Statistics StorageCacheStats; - StorageInstance Storage = - CreateBuildStorage(StorageStats, StorageCacheStats, ZenTempFolderPath(m_ZenFolderPath), /*RequireBucket*/ true); + StorageInstance Storage = CreateBuildStorage(StorageStats, + StorageCacheStats, + ZenTempFolderPath(m_ZenFolderPath), + /*RequriesNamespace*/ true, + /*RequireBucket*/ true); const Oid BuildId = ParseBuildId(); @@ -11005,8 +11018,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) } }); - StorageInstance Storage = - CreateBuildStorage(StorageStats, StorageCacheStats, ZenTempFolderPath(m_ZenFolderPath), /*RequireBucket*/ true); + StorageInstance Storage = CreateBuildStorage(StorageStats, + StorageCacheStats, + ZenTempFolderPath(m_ZenFolderPath), + /*RequriesNamespace*/ true, + /*RequireBucket*/ true); IoHash BlobHash = ParseBlobHash(); @@ -11050,8 +11066,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) } }); - StorageInstance Storage = - CreateBuildStorage(StorageStats, StorageCacheStats, ZenTempFolderPath(m_ZenFolderPath), /*RequireBucket*/ true); + StorageInstance Storage = CreateBuildStorage(StorageStats, + StorageCacheStats, + ZenTempFolderPath(m_ZenFolderPath), + /*RequriesNamespace*/ true, + /*RequireBucket*/ true); Oid BuildId = ParseBuildId(); @@ -11087,8 +11106,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) BuildStorage::Statistics StorageStats; BuildStorageCache::Statistics StorageCacheStats; - StorageInstance Storage = - CreateBuildStorage(StorageStats, StorageCacheStats, ZenTempFolderPath(m_ZenFolderPath), /*RequireBucket*/ true); + StorageInstance Storage = CreateBuildStorage(StorageStats, + StorageCacheStats, + ZenTempFolderPath(m_ZenFolderPath), + /*RequriesNamespace*/ true, + /*RequireBucket*/ true); Stopwatch Timer; for (const std::string& BuildIdString : m_BuildIds) @@ -11209,8 +11231,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) } MakeSafeAbsolutePathÍnPlace(m_ZenFolderPath); - StorageInstance Storage = - CreateBuildStorage(StorageStats, StorageCacheStats, ZenTempFolderPath(m_ZenFolderPath), /*RequireBucket*/ true); + StorageInstance Storage = CreateBuildStorage(StorageStats, + StorageCacheStats, + ZenTempFolderPath(m_ZenFolderPath), + /*RequriesNamespace*/ true, + /*RequireBucket*/ true); m_BuildId = Oid::NewOid().ToString(); m_BuildPartName = m_Path.filename().string(); |