mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-09-16 09:20:56 +00:00
WIP
This commit is contained in:
parent
c8d90ba455
commit
2d05a7b0f3
@ -8,49 +8,6 @@ struct IntegrationsView: View {
|
||||
|
||||
private let socketPath = (NSHomeDirectory().replacingOccurrences(of: Bundle.hostBundleID, with: Bundle.agentBundleID) as NSString).appendingPathComponent("socket.ssh") as String
|
||||
|
||||
private var instructions: [ConfigurationGroup] {
|
||||
[
|
||||
ConfigurationGroup(name:"Integrations", instructions: [
|
||||
ConfigurationFileInstructions("Getting Started", id: .gettingStarted),
|
||||
]),
|
||||
ConfigurationGroup(name: "System", instructions: [
|
||||
ConfigurationFileInstructions(
|
||||
tool: "ssh",
|
||||
configPath: "~/.ssh/config",
|
||||
configText: "Host *\n\tIdentityAgent \(socketPath)",
|
||||
website: URL(string: "https://man.openbsd.org/ssh_config.5")!,
|
||||
),
|
||||
ConfigurationFileInstructions(
|
||||
tool: "git",
|
||||
configPath: "~/.gitconfig",
|
||||
configText: "PLACEHOLDER",
|
||||
website: URL(string: "https://git-scm.com/docs/git-config")!
|
||||
)
|
||||
]),
|
||||
ConfigurationGroup(name: "Shell", instructions: [
|
||||
ConfigurationFileInstructions(
|
||||
tool: "zsh",
|
||||
configPath: "~/.zshrc",
|
||||
configText: "export SSH_AUTH_SOCK=\(socketPath)"
|
||||
),
|
||||
ConfigurationFileInstructions(
|
||||
tool: "bash",
|
||||
configPath: "~/.bashrc",
|
||||
configText: "export SSH_AUTH_SOCK=\(socketPath)"
|
||||
),
|
||||
ConfigurationFileInstructions(
|
||||
tool: "fish",
|
||||
configPath: "~/.config/fish/config.fish",
|
||||
configText: "set -x SSH_AUTH_SOCK \(socketPath)"
|
||||
),
|
||||
ConfigurationFileInstructions("other", id: .otherShell),
|
||||
]),
|
||||
ConfigurationGroup(name:"Apps", instructions: [
|
||||
ConfigurationFileInstructions("Other", id: .otherApp),
|
||||
]),
|
||||
]
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationSplitView {
|
||||
List(selection: $selectedInstruction) {
|
||||
@ -90,6 +47,11 @@ struct IntegrationsView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
} footer: {
|
||||
if let note = stepGroup.note {
|
||||
Text(note)
|
||||
.font(.caption)
|
||||
}
|
||||
}
|
||||
}
|
||||
if let url = selectedInstruction.website {
|
||||
@ -138,6 +100,78 @@ struct IntegrationsView: View {
|
||||
|
||||
}
|
||||
|
||||
extension IntegrationsView {
|
||||
|
||||
fileprivate var instructions: [ConfigurationGroup] {
|
||||
[
|
||||
ConfigurationGroup(name:"Integrations", instructions: [
|
||||
ConfigurationFileInstructions("Getting Started", id: .gettingStarted),
|
||||
]),
|
||||
ConfigurationGroup(
|
||||
name: "System",
|
||||
instructions: [
|
||||
ConfigurationFileInstructions(
|
||||
tool: "SSH",
|
||||
configPath: "~/.ssh/config",
|
||||
configText: "Host *\n\tIdentityAgent \(socketPath)",
|
||||
website: URL(string: "https://man.openbsd.org/ssh_config.5")!,
|
||||
),
|
||||
ConfigurationFileInstructions(
|
||||
tool: "Git Signing",
|
||||
steps: [
|
||||
.init(path: "~/.gitconfig", steps: [
|
||||
"""
|
||||
[user]
|
||||
signingkey = YOUR_PUBLIC_KEY_PATH
|
||||
[commit]
|
||||
gpgsign = true
|
||||
[gpg]
|
||||
format = ssh
|
||||
[gpg "ssh"]
|
||||
allowedSignersFile = ~/.gitallowedsigners
|
||||
"""
|
||||
],
|
||||
note: "If any section (like [user]) already exists, just add the entries in the existing section."
|
||||
|
||||
),
|
||||
.init(
|
||||
path: "~/.gitallowedsigners",
|
||||
steps: [
|
||||
"YOUR_PUBLIC_KEY"
|
||||
],
|
||||
note: "~/.gitallowedsigners probably does not exist. You'll need to create it."
|
||||
),
|
||||
],
|
||||
website: URL(string: "https://git-scm.com/docs/git-config")!,
|
||||
)
|
||||
]
|
||||
),
|
||||
ConfigurationGroup(name: "Shell", instructions: [
|
||||
ConfigurationFileInstructions(
|
||||
tool: "zsh",
|
||||
configPath: "~/.zshrc",
|
||||
configText: "export SSH_AUTH_SOCK=\(socketPath)"
|
||||
),
|
||||
ConfigurationFileInstructions(
|
||||
tool: "bash",
|
||||
configPath: "~/.bashrc",
|
||||
configText: "export SSH_AUTH_SOCK=\(socketPath)"
|
||||
),
|
||||
ConfigurationFileInstructions(
|
||||
tool: "fish",
|
||||
configPath: "~/.config/fish/config.fish",
|
||||
configText: "set -x SSH_AUTH_SOCK \(socketPath)"
|
||||
),
|
||||
ConfigurationFileInstructions("other", id: .otherShell),
|
||||
]),
|
||||
ConfigurationGroup(name:"Apps", instructions: [
|
||||
ConfigurationFileInstructions("Other", id: .otherApp),
|
||||
]),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct ConfigurationGroup: Identifiable {
|
||||
let id = UUID()
|
||||
var name: LocalizedStringResource
|
||||
@ -149,24 +183,29 @@ struct ConfigurationFileInstructions: Hashable, Identifiable {
|
||||
struct StepGroup: Hashable, Identifiable {
|
||||
let path: String
|
||||
let steps: [String]
|
||||
let note: String?
|
||||
var id: String { path }
|
||||
|
||||
init(path: String, steps: [String], note: String? = nil) {
|
||||
self.path = path
|
||||
self.steps = steps
|
||||
self.note = note
|
||||
}
|
||||
}
|
||||
|
||||
var id: ID
|
||||
var tool: String
|
||||
var steps: [StepGroup]
|
||||
var website: URL?
|
||||
var note: String?
|
||||
|
||||
init(tool: String, configPath: String, configText: String, website: URL? = nil, note: String? = nil) {
|
||||
init(tool: String, configPath: String, configText: String, website: URL? = nil) {
|
||||
self.id = .tool(tool)
|
||||
self.tool = tool
|
||||
self.steps = [StepGroup(path: configPath, steps: [configText])]
|
||||
self.website = website
|
||||
self.note = note
|
||||
}
|
||||
|
||||
init(tool: String, steps: [StepGroup], website: URL? = nil, note: String? = nil) {
|
||||
init(tool: String, steps: [StepGroup], website: URL? = nil) {
|
||||
self.id = .tool(tool)
|
||||
self.tool = tool
|
||||
self.steps = steps
|
||||
|
Loading…
Reference in New Issue
Block a user