@@ -158,6 +158,8 @@ public struct CLIParser {
158158 return remote ( . fill, session: session, parameters: [
159159 " target " : . string( arguments [ 0 ] ) , " value " : . string( arguments [ 1 ] ) ,
160160 ] , jsonOutput: jsonOutput)
161+ case " select " :
162+ return try parseSelect ( arguments, session: session, jsonOutput: jsonOutput)
161163 case " press " :
162164 guard arguments. count == 1 else { throw CLIParseError . missingArgument ( " KEY " ) }
163165 return remote ( . press, session: session, parameters: [ " key " : . string( arguments [ 0 ] ) ] , jsonOutput: jsonOutput)
@@ -401,6 +403,24 @@ public struct CLIParser {
401403 return remote ( . upload, session: session, parameters: parameters, jsonOutput: jsonOutput)
402404 }
403405
406+ private func parseSelect(
407+ _ arguments: [ String ] , session: String ? , jsonOutput: Bool
408+ ) throws -> CLIInvocation {
409+ var args = arguments
410+ let label = try removeOption ( " --label " , from: & args)
411+ let value = try removeOption ( " --value " , from: & args)
412+ guard ( label == nil ) != ( value == nil ) else {
413+ throw CLIParseError . missingArgument ( " exactly one of --label or --value " )
414+ }
415+ let invocation = try parseTargeted (
416+ . select, arguments: args, session: session, jsonOutput: jsonOutput
417+ )
418+ var parameters = invocation. request? . parameters ?? [ : ]
419+ if let label { parameters [ " label " ] = . string( label) }
420+ if let value { parameters [ " value " ] = . string( value) }
421+ return remote ( . select, session: session, parameters: parameters, jsonOutput: jsonOutput)
422+ }
423+
404424 private func parseTargeted(
405425 _ command: CommandName ,
406426 arguments: [ String ] ,
@@ -856,6 +876,8 @@ Commands:
856876 [--within @rN] [--limit N] [--budget TOKENS] [--depth N] [--text]
857877 click REF | click --role ROLE [--name NAME]
858878 fill REF TEXT | fill REF -- TEXT_WITH_LITERAL_FLAGS | press KEY
879+ select REF --label LABEL | select REF --value VALUE
880+ select --role ROLE [--name NAME] (--label LABEL | --value VALUE)
859881 upload REF --artifact FILE | upload --role ROLE [--name NAME] --artifact FILE
860882 scroll [up|down|top|bottom] [--amount PX]
861883 back | reload
0 commit comments