add snippet link

- has no way to add snips
update duplicatetheme
This commit is contained in:
neon443
2025-07-21 20:57:02 +01:00
parent 874250b5ee
commit d7aab6eaaa
5 changed files with 40 additions and 26 deletions

View File

@@ -30,7 +30,7 @@
A93143BE2DF4D0B300FCD5DB /* libpthread.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = A93143BD2DF4D0A700FCD5DB /* libpthread.tbd */; };
A93143C02DF61B3200FCD5DB /* Host.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93143BF2DF61B3200FCD5DB /* Host.swift */; };
A93143C62DF61FE300FCD5DB /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93143C52DF61FE300FCD5DB /* ViewModifiers.swift */; };
A93F283D2E2A5DCB0092B8D5 /* SnippetManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93F283C2E2A5DCB0092B8D5 /* SnippetManager.swift */; };
A93F283D2E2A5DCB0092B8D5 /* SnippetManagerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93F283C2E2A5DCB0092B8D5 /* SnippetManagerView.swift */; };
A93F28412E2A5EEA0092B8D5 /* Snippet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93F28402E2A5EEA0092B8D5 /* Snippet.swift */; };
A9485C712E1AECD000209824 /* JetBrainsMonoNerdFontMono-Italic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A9485C702E1AECD000209824 /* JetBrainsMonoNerdFontMono-Italic.ttf */; };
A9485C722E1AECD000209824 /* JetBrainsMonoNerdFontMono-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A9485C6E2E1AECD000209824 /* JetBrainsMonoNerdFontMono-Bold.ttf */; };
@@ -155,7 +155,7 @@
A93143BF2DF61B3200FCD5DB /* Host.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Host.swift; sourceTree = "<group>"; };
A93143C22DF61F5700FCD5DB /* ShhShell.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ShhShell.entitlements; sourceTree = "<group>"; };
A93143C52DF61FE300FCD5DB /* ViewModifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModifiers.swift; sourceTree = "<group>"; };
A93F283C2E2A5DCB0092B8D5 /* SnippetManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnippetManager.swift; sourceTree = "<group>"; };
A93F283C2E2A5DCB0092B8D5 /* SnippetManagerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnippetManagerView.swift; sourceTree = "<group>"; };
A93F28402E2A5EEA0092B8D5 /* Snippet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Snippet.swift; sourceTree = "<group>"; };
A9485C6E2E1AECD000209824 /* JetBrainsMonoNerdFontMono-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "JetBrainsMonoNerdFontMono-Bold.ttf"; sourceTree = "<group>"; };
A9485C6F2E1AECD000209824 /* JetBrainsMonoNerdFontMono-BoldItalic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "JetBrainsMonoNerdFontMono-BoldItalic.ttf"; sourceTree = "<group>"; };
@@ -439,7 +439,7 @@
A93F283E2E2A5DDE0092B8D5 /* Snippets */ = {
isa = PBXGroup;
children = (
A93F283C2E2A5DCB0092B8D5 /* SnippetManager.swift */,
A93F283C2E2A5DCB0092B8D5 /* SnippetManagerView.swift */,
);
path = Snippets;
sourceTree = "<group>";
@@ -779,7 +779,7 @@
A9FD37592E143D74005319A8 /* GenericPasswordConvertible.swift in Sources */,
A9485C762E1AF59F00209824 /* FontManagerView.swift in Sources */,
A98554592E0553AA009051BD /* KeyManager.swift in Sources */,
A93F283D2E2A5DCB0092B8D5 /* SnippetManager.swift in Sources */,
A93F283D2E2A5DCB0092B8D5 /* SnippetManagerView.swift in Sources */,
A9C897EF2DF1A9A400EF9A5F /* SSHHandler.swift in Sources */,
A9D819312E102D8700442D38 /* HostkeysView.swift in Sources */,
A98554552E05535F009051BD /* KeyManagerView.swift in Sources */,

View File

@@ -144,8 +144,9 @@ class HostsManager: ObservableObject, @unchecked Sendable {
func duplicateTheme(_ theme: Theme) {
var newTheme = theme
newTheme.id = UUID().uuidString
newTheme.name.append(" copy")
if let index = themes.firstIndex(where: { $0.id == theme.id }) {
themes.insert(newTheme, at: index)
themes.insert(newTheme, at: index+1)
} else {
themes.append(newTheme)
}

View File

@@ -43,7 +43,11 @@ struct ContentView: View {
}
}
NavigationLink {
SnippetManagerView(hostsManager: hostsManager)
} label: {
Label("Snippets", systemImage: "paperclip")
}
NavigationLink {
KeyManagerView(hostsManager: hostsManager, keyManager: keyManager)

View File

@@ -1,20 +0,0 @@
//
// SnippetManager.swift
// ShhShell
//
// Created by neon443 on 18/07/2025.
//
import SwiftUI
struct SnippetManager: View {
@ObservedObject var hostsManager: HostsManager
var body: some View {
}
}
#Preview {
SnippetManager(hostsManager: HostsManager())
}

View File

@@ -0,0 +1,29 @@
//
// SnippetManagerView.swift
// ShhShell
//
// Created by neon443 on 18/07/2025.
//
import SwiftUI
struct SnippetManagerView: View {
@ObservedObject var hostsManager: HostsManager
var body: some View {
ForEach(hostsManager.snippets) { snip in
Text(snip.name)
.bold()
.font(.subheadline)
Text(snip.content)
}
.toolbar {
}
}
}
#Preview {
SnippetManagerView(hostsManager: HostsManager())
}