feat: Breaking out more dependencies.

This commit is contained in:
2024-12-11 09:23:34 -05:00
parent 92cd6afa2b
commit 9c784d4dcb
9 changed files with 62 additions and 313 deletions

View File

@@ -16,7 +16,7 @@ func runPlaybook(
) async throws {
try await withSetupLogger(commandName: commandName, globals: globals) {
@Dependency(\.cliClient) var cliClient
@Dependency(\.configuration) var configurationClient
@Dependency(\.configurationClient) var configurationClient
@Dependency(\.logger) var logger
logger.debug("Begin run playbook: \(globals)")

View File

@@ -1,5 +1,6 @@
import ConfigurationClient
import Dependencies
import FileClient
import ShellClient
func runVault(
@@ -9,7 +10,8 @@ func runVault(
) async throws {
try await withSetupLogger(commandName: commandName, globals: options.globals) {
@Dependency(\.cliClient) var cliClient
@Dependency(\.configuration) var configurationClient
@Dependency(\.configurationClient) var configurationClient
@Dependency(\.fileClient) var fileClient
@Dependency(\.logger) var logger
logger.debug("Begin run vault: \(options)")
@@ -21,7 +23,10 @@ func runVault(
if let file = options.file {
path = file
} else {
path = try cliClient.findVaultFileInCurrentDirectory()
guard let url = try await fileClient.findVaultFileInCurrentDirectory() else {
throw VaultFileNotFound()
}
path = url.cleanFilePath
}
logger.debug("Vault path: \(path)")
@@ -48,3 +53,5 @@ func runVault(
)
}
}
struct VaultFileNotFound: Error {}