Skip to content

Commit 37689bd

Browse files
committed
Add preference key for custom commands
1 parent 27a54dd commit 37689bd

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Foundation
2+
3+
public struct CustomCommand: Codable {
4+
public enum Feature: Codable {
5+
case promptToCode(prompt: String, continuousMode: Bool)
6+
case chatWithSelection(prompt: String)
7+
case customChat(systemPrompt: String?, prompt: String)
8+
}
9+
10+
public var name: String
11+
public var feature: Feature
12+
}

Core/Sources/Preferences/Keys.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,19 @@ public extension UserDefaultPreferenceKeys {
207207
var chatGPTLanguage: ChatGPTLanguage { .init() }
208208
}
209209

210+
// MARK: - Custom Commands
211+
212+
public extension UserDefaultPreferenceKeys {
213+
struct CustomCommandsKey: UserDefaultPreferenceKey {
214+
public let defaultValue: [CustomCommand] = []
215+
public let key = "CustomCommands"
216+
}
217+
218+
var customCommands: CustomCommandsKey { .init() }
219+
}
220+
221+
// MARK: - Feature Flags
222+
210223
public enum FeatureFlags {
211224
public struct DisableLazyVStack: UserDefaultPreferenceKey {
212225
public let defaultValue = false

0 commit comments

Comments
 (0)