1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "../zen.h"
#include <filesystem>
namespace zen {
class WorkspaceCommand : public CacheStoreCommand
{
public:
static constexpr char Name[] = "workspace";
static constexpr char Description[] = "Manage workspaces - create, remove, info";
WorkspaceCommand();
~WorkspaceCommand();
virtual void Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{Name, Description};
std::string m_HostName;
std::filesystem::path m_SystemRootDir;
std::string m_Verb; // create, info, remove
std::string m_Id;
cxxopts::Options m_CreateOptions{"create", "Create a workspace"};
std::string m_Path;
bool m_AllowShareCreationFromHttp = false;
cxxopts::Options m_InfoOptions{"info", "Info about a workspace"};
cxxopts::Options m_RemoveOptions{"remove", "Remove a workspace"};
cxxopts::Options* m_SubCommands[3] = {&m_CreateOptions, &m_InfoOptions, &m_RemoveOptions};
};
class WorkspaceShareCommand : public CacheStoreCommand
{
public:
static constexpr char Name[] = "workspace-share";
static constexpr char Description[] =
"Manage workspace shared folders in a workspace - create, remove, info, files, entries, get, batch";
WorkspaceShareCommand();
~WorkspaceShareCommand();
virtual void Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) override;
virtual cxxopts::Options& Options() override { return m_Options; }
private:
cxxopts::Options m_Options{Name, Description};
std::string m_HostName;
std::filesystem::path m_SystemRootDir;
std::string m_WorkspaceId;
std::filesystem::path m_WorkspaceRoot;
std::string m_Verb; // create, info, remove
std::string m_ShareId;
std::string m_Alias;
cxxopts::Options m_CreateOptions{"create", "Create a workspace share"};
std::filesystem::path m_SharePath;
bool m_Refresh = false;
cxxopts::Options m_InfoOptions{"info", "Info about a workspace share"};
cxxopts::Options m_RemoveOptions{"remove", "Remove a workspace share"};
std::string m_FieldFilter;
cxxopts::Options m_FilesOptions{"files", "List files in a workspace share"};
std::string m_ChunkId;
cxxopts::Options m_EntriesOptions{"entries", "List entries in a workspace shared folder"};
cxxopts::Options m_GetChunkOptions{"get", "List entries in a workspace shared folder"};
uint64_t m_Offset = 0;
uint64_t m_Size = ~uint64_t(0);
cxxopts::Options m_GetChunkBatchOptions{"batch", "Get a batch of chunks from a workspace shared folder"};
std::vector<std::string> m_ChunkIds;
cxxopts::Options* m_SubCommands[7] = {&m_CreateOptions,
&m_InfoOptions,
&m_RemoveOptions,
&m_FilesOptions,
&m_EntriesOptions,
&m_GetChunkOptions,
&m_GetChunkBatchOptions};
};
} // namespace zen
|