                 }
             }
         case .code:
-            code = argument
+            guard !argument.hasPrefix("-") else {
+                code = .fromClipboard
+                return try parse(argument: argument)
+            }
+
+            code = .custom(argument)
         case .url:
-            codeURL = URL(string: argument)
+            code = URL(string: argument).map(Code.fromURL)
         case .addViewCode:
-            addViewCode = true
+            code = .view
             return try parse(argument: argument)
         case .forceOverwrite:
             forceOverwrite = true

extension Playground {
    func apply(_ options: Options) throws {
        platform = options.platform

        if let newCode = options.code {
            code = newCode
        } else if options.addViewCode {
            let viewClass: String
            var viewCode: String

            switch platform {
            case .iOS, .tvOS:
                viewCode = "import UIKit"
                viewClass = "UIView"
            case .macOS:
                viewCode = "import Cocoa"
                viewClass = "NSView"
            }

            viewCode.append("\nimport PlaygroundSupport\n\n")
            viewCode.append("let viewFrame = CGRect(x: 0, y: 0, width: 500, height: 500)\n")
            viewCode.append("let view = \(viewClass)(frame: viewFrame)\n")

            switch platform {
            case .iOS, .tvOS:
                viewCode.append("view.backgroundColor = .white\n")
            case .macOS:
                viewCode.append("view.wantsLayer = true\n")
                viewCode.append("view.layer!.backgroundColor = NSColor.white.cgColor\n")
            }

            viewCode.append("PlaygroundPage.current.liveView = view\n")

            code = viewCode
        } else if let url = options.codeURL {
            var loadedCode = try loadCode(from: url)

            if loadedCode.contains("import Cocoa") || loadedCode.contains("import AppKit") {
                platform = .macOS
            } else if !loadedCode.contains("import Foundation") && !loadedCode.contains("import UIKit") {
                loadedCode = "import Foundation\n\n" + loadedCode
            }

            code = loadedCode
        }
    }

    private func loadCode(from url: URL) throws -> String {

        }

        return nil
    }
}

extension Options {
    enum Code {
        case view
        case fromClipboard
        case fromURL(URL)
        case custom(String)
    }
}

