From 168ee3c269cdf02268e3852c4c107fdf8242f1cc Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Sun, 20 Sep 2020 20:36:29 -0700 Subject: [PATCH] Fix test shell --- .../ShellConfigurationController.swift | 43 ++++++++----------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/Secretive/Controllers/ShellConfigurationController.swift b/Secretive/Controllers/ShellConfigurationController.swift index 52796b7..4162a60 100644 --- a/Secretive/Controllers/ShellConfigurationController.swift +++ b/Secretive/Controllers/ShellConfigurationController.swift @@ -2,33 +2,28 @@ import Foundation import Cocoa struct ShellConfigurationController { - + let socketPath = (NSHomeDirectory().replacingOccurrences(of: "com.maxgoedjen.Secretive.Host", with: "com.maxgoedjen.Secretive.SecretAgent") as NSString).appendingPathComponent("socket.ssh") as String - + var shellInstructions: [ShellConfigInstruction] { [ - ShellConfigInstruction(shell: "test", - shellConfigDirectory: "~/", - shellConfigFilename: ".test", - text: "export SSH_AUTH_SOCK=\(socketPath)"), - - // ShellConfigInstruction(shell: "zsh", - // shellConfigDirectory: "~/", - // shellConfigFilename: ".zshrc", - // text: "export SSH_AUTH_SOCK=\(socketPath)"), - ShellConfigInstruction(shell: "bash", - shellConfigDirectory: "~/", - shellConfigFilename: ".bashrc", - text: "export SSH_AUTH_SOCK=\(socketPath)"), - ShellConfigInstruction(shell: "fish", - shellConfigDirectory: "~/.config/fish", - shellConfigFilename: "config.fish", - text: "set -x SSH_AUTH_SOCK=\(socketPath)"), - ] - + ShellConfigInstruction(shell: "zsh", + shellConfigDirectory: "~/", + shellConfigFilename: ".zshrc", + text: "export SSH_AUTH_SOCK=\(socketPath)"), + ShellConfigInstruction(shell: "bash", + shellConfigDirectory: "~/", + shellConfigFilename: ".bashrc", + text: "export SSH_AUTH_SOCK=\(socketPath)"), + ShellConfigInstruction(shell: "fish", + shellConfigDirectory: "~/.config/fish", + shellConfigFilename: "config.fish", + text: "set -x SSH_AUTH_SOCK=\(socketPath)"), + ] + } - - + + func addToShell(shellInstructions: ShellConfigInstruction) -> Bool { let openPanel = NSOpenPanel() // This is sync, so no need to strongly retain @@ -59,5 +54,5 @@ struct ShellConfigurationController { handle.write("\n# Secretive Config\n\(shellInstructions.text)\n".data(using: .utf8)!) return true } - + }