Skip to content

Commit e7a6b8a

Browse files
committed
feat: added flag if keyboard layout input source should be provided
1 parent de4016b commit e7a6b8a

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

Sources/InputSourceManagerCli/GetInputSource.swift

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,24 @@ struct GetInputSource: ParsableCommand {
99
abstract: "Gets the current input source"
1010
)
1111

12+
@Flag(help: "Indicatetes if keyboard layout input source should be provided.")
13+
var layout = false
14+
1215
func run() throws {
1316
let manager = InputSourceManager()
14-
guard let inputSource = manager.getCurrentKeybaordInputSource() else {
15-
print("No input source found")
16-
return
17-
}
1817

19-
guard let layouInputSource = manager.getCurrentKeybaordLayoutInputSource() else {
20-
print("No input source found")
21-
return
18+
if layout {
19+
guard let inputSource = manager.getCurrentKeybaordLayoutInputSource() else {
20+
print("No input source found")
21+
return
22+
}
23+
print("Id :\(inputSource.id), name: \(inputSource.localizedName)")
24+
} else {
25+
guard let inputSource = manager.getCurrentKeybaordInputSource() else {
26+
print("No input source found")
27+
return
28+
}
29+
print("Id :\(inputSource.id), name: \(inputSource.localizedName)")
2230
}
23-
24-
print("Id :\(inputSource.id), name: \(inputSource.localizedName)")
25-
print("Id :\(layouInputSource.id), name: \(layouInputSource.localizedName)")
2631
}
2732
}

0 commit comments

Comments
 (0)