Sources/OrgApp/AppStoreCommands.swift

21 lines · 807 bytes

3 symbols in this file
 1import Foundation
 2
 3/// The commands the Mac App Store build leaves out of the palette and menus: exports that run
 4/// Emacs, and attaching by link, which the sandbox doesn't allow. The iOS app refuses those
 5/// with nothing in their place too.
 6public enum AppStoreCommands {
 7    public static let hidden: Set<String> = [
 8        "app.export.pdf",
 9        "app.attach.link", "app.attach.symlink",
10    ]
11
12    /// What a key bound to a hidden command runs instead; nil when nothing takes its place.
13    public static func replacement(for id: String) -> String? {
14        id == "app.export.pdf" ? "app.export.print-pdf" : nil
15    }
16
17    /// A hidden command with nothing in its place.
18    public static func unavailable(_ id: String) -> Bool {
19        hidden.contains(id) && replacement(for: id) == nil
20    }
21}