File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ import AVFoundation
2121import ArgumentParser
2222import Cocoa
2323
24+ let packageVersion = " 0.2.1 "
25+
2426var recorder : WindowRecorder ?
2527
2628signal ( SIGINT) { _ in
@@ -33,6 +35,9 @@ signal(SIGTERM) { _ in
3335}
3436
3537struct RecordCommand : ParsableCommand {
38+ @Flag ( name: [ . customLong( " version " ) ] , help: " Show version. " )
39+ var showVersion : Bool = false
40+
3641 @Flag ( name: . shortAndLong, help: " List recordable windows. " )
3742 var list : Bool = false
3843
@@ -67,6 +72,15 @@ struct RecordCommand: ParsableCommand {
6772 var output : String ?
6873
6974 mutating func run( ) throws {
75+ if showVersion {
76+ guard let binPath = CommandLine . arguments. first else {
77+ print ( " Error: binary name not available " )
78+ Darwin . exit ( 1 )
79+ }
80+ print ( " \( URL ( fileURLWithPath: binPath) . lastPathComponent) \( packageVersion) " )
81+ Darwin . exit ( 0 )
82+ }
83+
7084 if list {
7185 NSWorkspace . shared. printWindowList ( )
7286 Darwin . exit ( 0 )
You can’t perform that action at this time.
0 commit comments