feat: Breaking out more dependencies.
This commit is contained in:
@@ -64,7 +64,7 @@ struct CreateCommand: AsyncParsableCommand {
|
||||
try await withSetupLogger(commandName: Self.commandName, globals: globals) {
|
||||
@Dependency(\.coders) var coders
|
||||
@Dependency(\.cliClient) var cliClient
|
||||
@Dependency(\.configuration) var configurationClient
|
||||
@Dependency(\.configurationClient) var configurationClient
|
||||
@Dependency(\.logger) var logger
|
||||
|
||||
let encoder = coders.jsonEncoder()
|
||||
|
||||
@@ -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)")
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
Reference in New Issue
Block a user