Skip to content

Commit 40287d2

Browse files
authored
Merge pull request #45 from Automattic/simplify/cli-surface
Simplify CLI Surface
2 parents 96a3eb9 + e493d53 commit 40287d2

16 files changed

+3
-636
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RELEASE_VERSION = $(shell .build/release/hostmgr --version)
55
lint:
66
docker run -it --rm -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:0.47.1 swiftlint lint --strict
77

8-
autocorrect:
8+
lintfix:
99
docker run -it --rm -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:0.47.1 swiftlint --autocorrect
1010

1111
build-release:

Sources/hostmgr/SyncCommand.swift

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,7 @@ struct SyncCommand: AsyncParsableCommand {
77
commandName: "sync",
88
abstract: "Sync remote data with this host",
99
subcommands: [
10-
SyncAuthorizedKeysCommand.self,
11-
SyncVMImagesCommand.self
10+
SyncAuthorizedKeysCommand.self
1211
]
1312
)
14-
15-
@Flag(help: "List available sync tasks")
16-
var list: Bool = false
17-
18-
@OptionGroup
19-
var options: SharedSyncOptions
20-
21-
mutating func run() async throws {
22-
23-
if list {
24-
Configuration.SchedulableSyncCommand.allCases.forEach { print($0) }
25-
return
26-
}
27-
28-
// Always regenerate the git mirror manifest – this is a lazy hack
29-
// to make it so it doesn't need to be installed separately
30-
try GenerateGitMirrorManifestTask().run()
31-
32-
for task in Configuration.shared.syncTasks {
33-
options.force ? print("Force-running \(task.rawValue)") : print("Running \(task.rawValue)")
34-
try await perform(task: task)
35-
}
36-
}
37-
38-
private func perform(task: Configuration.SchedulableSyncCommand) async throws {
39-
switch task {
40-
case .authorizedKeys:
41-
let command = SyncAuthorizedKeysCommand(options: self._options)
42-
try await command.run()
43-
case .vmImages:
44-
let command = SyncVMImagesCommand(options: self._options)
45-
try await command.run()
46-
}
47-
}
4813
}

Sources/hostmgr/VMCommand.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ struct VMCommand: AsyncParsableCommand {
1212
VMStartCommand.self,
1313
VMStopCommand.self,
1414
VMDetailsCommand.self,
15-
VMDeleteCommand.self,
16-
VMCloneCommand.self,
17-
VMCleanCommand.self,
18-
VMImportCommand.self,
19-
VMImageCommand.self,
20-
VMExistsCommand.self
15+
VMCleanCommand.self
2116
]
2217
)
2318
}

Sources/hostmgr/commands/sync/SyncVMImagesCommand.swift

Lines changed: 0 additions & 90 deletions
This file was deleted.

Sources/hostmgr/commands/vm/ImageCommand.swift

Lines changed: 0 additions & 15 deletions
This file was deleted.

Sources/hostmgr/commands/vm/VMClone.swift

Lines changed: 0 additions & 155 deletions
This file was deleted.

Sources/hostmgr/commands/vm/VMDelete.swift

Lines changed: 0 additions & 36 deletions
This file was deleted.

Sources/hostmgr/commands/vm/VMExists.swift

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)