Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495import ArgumentParserimport Foundationimport ParcelIPC
struct SetupCommand: AsyncParsableCommand { @OptionGroup var output: CLIOptions
static let configuration = CommandConfiguration( commandName: "setup", abstract: String( localized: "List, save, open, or delete named setups.", bundle: .module), subcommands: [ SetupListCommand.self, SetupSaveCommand.self, SetupNamedCommand<SetupOpen>.self, SetupNamedCommand<SetupDelete>.self, ], defaultSubcommand: SetupListCommand.self)}
struct SetupListCommand: CLICommand { static let configuration = CommandConfiguration( commandName: "list", abstract: String(localized: "List saved setups.", bundle: .module))
@OptionGroup var output: CLIOptions
var invocation: CLIInvocation { .request(command: "query", args: [SetupIPC.queryName], query: .setups, json: output.json) }}
struct SetupSaveCommand: CLICommand { static let configuration = CommandConfiguration( commandName: "save", abstract: String(localized: "Save the current arrangement as a named setup.", bundle: .module))
@OptionGroup var output: CLIOptions @Argument( help: ArgumentHelp( String(localized: "Setup name. Quote names containing spaces.", bundle: .module), valueName: "name")) var name: String @Flag( help: ArgumentHelp( String( localized: "Do not hide other applications when this setup opens.", bundle: .module))) var noHide = false
mutating func validate() throws { try CLIParsing.requireName(name) }
var invocation: CLIInvocation { get throws { let request = try SetupIPC.Mutation.save.request(name: name, noHide: noHide) return .request(command: request.command, args: request.args, query: nil, json: output.json) } }}
protocol SetupMutationShortcut { static var mutation: SetupIPC.Mutation { get } static var abstract: String { get }}
struct SetupNamedCommand<Action: SetupMutationShortcut>: CLICommand { static var configuration: CommandConfiguration { CommandConfiguration( commandName: String(Action.mutation.rawValue.dropFirst("setup-".count)), abstract: Action.abstract) }
@OptionGroup var output: CLIOptions @Argument( help: ArgumentHelp( String(localized: "Setup name. Quote names containing spaces.", bundle: .module), valueName: "name")) var name: String
mutating func validate() throws { try CLIParsing.requireName(name) }
var invocation: CLIInvocation { get throws { let request = try Action.mutation.request(name: name) return .request(command: request.command, args: request.args, query: nil, json: output.json) } }}
enum SetupOpen: SetupMutationShortcut { static let mutation = SetupIPC.Mutation.open static var abstract: String { String(localized: "Open a saved setup.", bundle: .module) }}
enum SetupDelete: SetupMutationShortcut { static let mutation = SetupIPC.Mutation.delete static var abstract: String { String(localized: "Delete a saved setup.", bundle: .module) }}