             case .forceOverwrite:
                 forceOverwrite = true
             case .addViewCode:
-                addViewCode = true
+                code = .view
             case .code:
-                guard var clipboard = NSPasteboard.general.string(forType: .string) else {
-                    throw PlaygroundError.missingValue(danglingFlag)
-                }
-
-                guard !clipboard.isEmpty else {
-                    throw PlaygroundError.missingValue(danglingFlag)
-                }
-
-                if !clipboard.contains("import ") {
-                    clipboard = "import Foundation\nimport PlaygroundSupport\n\n" + clipboard
-                }
-
-                code = clipboard
+                code = .fromClipboard
             case .help:
                 displayHelp = true
             }
         }
 
-        if codeURL != nil && targetPath == defaultTargetPath {
+        if code != nil && (try? Folder(path: targetPath)) != nil {
             targetPath += "-\(UUID().uuidString)"
         }
     }

    var targetPath: String
    var platform = Playground.Platform.iOS
    var dependencies = [Folder]()
    var code: String? = nil
    var codeURL: URL? = nil
    var addViewCode = false
    var forceOverwrite = false
    var displayHelp = false

    init(arguments: [String] = CommandLine.argumentsExcludingLaunchPath) throws {
        let defaultTargetPath = "~/Desktop/\(Date().today)"
        targetPath = defaultTargetPath

        var currentFlag: Flag?

                }
            }
        case .code:
            guard !argument.hasPrefix("-") else {
                code = .fromClipboard
                return try parse(argument: argument)
            }

            code = .custom(argument)
        case .url:
            code = URL(string: argument).map(Code.fromURL)
        case .addViewCode:
            code = .view
            return try parse(argument: argument)
        case .forceOverwrite:
            forceOverwrite = true
