Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

821 B
Raw Blame
import Foundation
import ArgumentParser

struct VMDisplayResolution: Codable, ExpressibleByArgument {
        let width: Int
        let height: Int
        
        init?(string: String) {
            let components = string.components(separatedBy: "x")
            guard components.count == 2,
                  let width = Int(components[0]),
                  let height = Int(components[1]),
                  width > 0, height > 0 else {
                return nil
            }
            self.width = width
            self.height = height
        }
        
        var string: String {
            "\(width)x\(height)"
        }
        
        init?(argument: String) {
            guard let resolution = VMDisplayResolution(string: argument) else { return nil }
            self = resolution
        }
    }