-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e6d176
commit cb153ff
Showing
10 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import AppKit | ||
import Common | ||
|
||
struct ListModesCommand: Command { | ||
let args: ListModesCmdArgs | ||
|
||
func run(_ env: CmdEnv, _ io: CmdIo) -> Bool { | ||
check(Thread.current.isMainThread) | ||
|
||
if args.current { | ||
return io.out(activeMode ?? mainModeId) | ||
} else { | ||
let modeNames: [String] = config.modes.map { $0.key } | ||
return io.out(modeNames) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@testable import AppBundle | ||
import Common | ||
import XCTest | ||
|
||
final class ListModesTest: XCTestCase { | ||
override func setUpWithError() throws { setUpWorkspacesForTests() } | ||
|
||
func testParseListModesCommand() { | ||
testParseCommandSucc("list-modes", ListModesCmdArgs(rawArgs: [])) | ||
testParseCommandSucc("list-modes --current", ListModesCmdArgs(rawArgs: []).copy(\.current, true)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
public struct ListModesCmdArgs: CmdArgs { | ||
public let rawArgs: EquatableNoop<[String]> | ||
public init(rawArgs: [String]) { | ||
self.rawArgs = .init(rawArgs) | ||
} | ||
public static var parser: CmdParser<Self> = cmdParser( | ||
kind: .listModes, | ||
allowInConfig: false, | ||
help: list_modes_help_generated, | ||
options: [ | ||
"--current": trueBoolFlag(\.current), | ||
], | ||
arguments: [] | ||
) | ||
|
||
public var windowId: UInt32? // unused | ||
public var workspaceName: WorkspaceName? // unused | ||
public var current: Bool = false | ||
} | ||
|
||
public func parseListModesCmdArgs(_ args: [String]) -> ParsedCmd<ListModesCmdArgs> { | ||
parseSpecificCmdArgs(ListModesCmdArgs(rawArgs: args), args) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
= aerospace-list-modes(1) | ||
include::util/man-attributes.adoc[] | ||
// tag::purpose[] | ||
:manpurpose: Print a list of modes currently specified in the configuration | ||
// end::purpose[] | ||
:manname: aerospace-list-modes | ||
|
||
// =========================================================== Synopsis | ||
== Synopsis | ||
[verse] | ||
// tag::synopsis[] | ||
aerospace list-modes [-h|--help] [--current] | ||
|
||
// end::synopsis[] | ||
|
||
// =========================================================== Description | ||
== Description | ||
|
||
// tag::body[] | ||
{manpurpose} | ||
|
||
See xref:guide.adoc#binding-modes[the guide] for documentation about binding modes | ||
|
||
// =========================================================== Options | ||
include::util/conditional-options-header.adoc[] | ||
|
||
-h, --help:: Print help | ||
|
||
--current:: | ||
Only print the currently active mode | ||
|
||
// end::body[] | ||
|
||
// =========================================================== Footer | ||
include::util/man-footer.adoc[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters