blob: ddd2db215a68213b4a41144688b0024690be4dff (
plain) (
blame)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "../zen.h"
#include <filesystem>
namespace zen {
class WorkspaceCommand;
class WorkspaceShareCommand;
//////////////////////////////////////////////////////////////////////////
// WorkspaceCommand subcommands
class WorkspaceCreateSubCmd : public ZenSubCmdBase
{
public:
explicit WorkspaceCreateSubCmd(WorkspaceCommand& Parent);
void Run(const ZenCliOptions& GlobalOptions) override;
private:
WorkspaceCommand& m_Parent;
};
class WorkspaceInfoSubCmd : public ZenSubCmdBase
{
public:
explicit WorkspaceInfoSubCmd(WorkspaceCommand& Parent);
void Run(const ZenCliOptions& GlobalOptions) override;
private:
WorkspaceCommand& m_Parent;
};
class WorkspaceRemoveSubCmd : public ZenSubCmdBase
{
public:
explicit WorkspaceRemoveSubCmd(WorkspaceCommand& Parent);
void Run(const ZenCliOptions& GlobalOptions) override;
private:
WorkspaceCommand& m_Parent;
};
class WorkspaceCommand : public CacheStoreCmdWithSubCommands
{
public:
static constexpr char Name[] = "workspace";
static constexpr char Description[] = "Manage workspaces - create, remove, info";
WorkspaceCommand();
~WorkspaceCommand();
cxxopts::Options& Options() override { return m_Options; }
protected:
bool OnParentOptionsParsed(const ZenCliOptions& GlobalOptions) override;
private:
friend class WorkspaceCreateSubCmd;
friend class WorkspaceInfoSubCmd;
friend class WorkspaceRemoveSubCmd;
cxxopts::Options m_Options{Name, Description};
std::string m_SubCommand;
std::string m_HostName;
std::filesystem::path m_SystemRootDir;
std::filesystem::path m_StatePath;
// Shared subcommand state
std::string m_Id;
std::string m_Path;
bool m_AllowShareCreationFromHttp = false;
// Subcommand instances
WorkspaceCreateSubCmd m_CreateSubCmd{*this};
WorkspaceInfoSubCmd m_InfoSubCmd{*this};
WorkspaceRemoveSubCmd m_RemoveSubCmd{*this};
};
//////////////////////////////////////////////////////////////////////////
// WorkspaceShareCommand subcommands
class WsShareCreateSubCmd : public ZenSubCmdBase
{
public:
explicit WsShareCreateSubCmd(WorkspaceShareCommand& Parent);
void Run(const ZenCliOptions& GlobalOptions) override;
private:
WorkspaceShareCommand& m_Parent;
};
class WsShareInfoSubCmd : public ZenSubCmdBase
{
public:
explicit WsShareInfoSubCmd(WorkspaceShareCommand& Parent);
void Run(const ZenCliOptions& GlobalOptions) override;
private:
WorkspaceShareCommand& m_Parent;
};
class WsShareRemoveSubCmd : public ZenSubCmdBase
{
public:
explicit WsShareRemoveSubCmd(WorkspaceShareCommand& Parent);
void Run(const ZenCliOptions& GlobalOptions) override;
private:
WorkspaceShareCommand& m_Parent;
};
class WsShareFilesSubCmd : public ZenSubCmdBase
{
public:
explicit WsShareFilesSubCmd(WorkspaceShareCommand& Parent);
void Run(const ZenCliOptions& GlobalOptions) override;
private:
WorkspaceShareCommand& m_Parent;
};
class WsShareEntriesSubCmd : public ZenSubCmdBase
{
public:
explicit WsShareEntriesSubCmd(WorkspaceShareCommand& Parent);
void Run(const ZenCliOptions& GlobalOptions) override;
private:
WorkspaceShareCommand& m_Parent;
};
class WsShareGetSubCmd : public ZenSubCmdBase
{
public:
explicit WsShareGetSubCmd(WorkspaceShareCommand& Parent);
void Run(const ZenCliOptions& GlobalOptions) override;
private:
WorkspaceShareCommand& m_Parent;
};
class WsShareBatchSubCmd : public ZenSubCmdBase
{
public:
explicit WsShareBatchSubCmd(WorkspaceShareCommand& Parent);
void Run(const ZenCliOptions& GlobalOptions) override;
private:
WorkspaceShareCommand& m_Parent;
};
class WorkspaceShareCommand : public CacheStoreCmdWithSubCommands
{
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();
cxxopts::Options& Options() override { return m_Options; }
/// Build a URL segment identifying the share (by alias or workspace/share id pair).
std::string GetShareIdentityUrl() const;
protected:
bool OnParentOptionsParsed(const ZenCliOptions& GlobalOptions) override;
private:
friend class WsShareCreateSubCmd;
friend class WsShareInfoSubCmd;
friend class WsShareRemoveSubCmd;
friend class WsShareFilesSubCmd;
friend class WsShareEntriesSubCmd;
friend class WsShareGetSubCmd;
friend class WsShareBatchSubCmd;
cxxopts::Options m_Options{Name, Description};
std::string m_SubCommand;
std::string m_HostName;
std::filesystem::path m_SystemRootDir;
std::filesystem::path m_StatePath;
// Shared subcommand state
std::string m_WorkspaceId;
std::filesystem::path m_WorkspaceRoot;
std::string m_ShareId;
std::string m_Alias;
std::string m_FieldFilter;
bool m_Refresh = false;
// Get-specific
std::string m_ChunkId;
uint64_t m_Offset = 0;
uint64_t m_Size = ~uint64_t(0);
// Batch-specific
std::vector<std::string> m_ChunkIds;
// Create-specific
std::filesystem::path m_SharePath;
// Subcommand instances
WsShareCreateSubCmd m_CreateSubCmd{*this};
WsShareInfoSubCmd m_InfoSubCmd{*this};
WsShareRemoveSubCmd m_RemoveSubCmd{*this};
WsShareFilesSubCmd m_FilesSubCmd{*this};
WsShareEntriesSubCmd m_EntriesSubCmd{*this};
WsShareGetSubCmd m_GetSubCmd{*this};
WsShareBatchSubCmd m_BatchSubCmd{*this};
};
} // namespace zen
|