|
| 1 | +// |
| 2 | +// Target.swift |
| 3 | +// |
| 4 | +// |
| 5 | +// Created by Pavel Kasila on 27.03.22. |
| 6 | +// |
| 7 | + |
| 8 | +import Foundation |
| 9 | + |
| 10 | +/// This structure stores information about the target to be available in CodeEdit for running |
| 11 | +public struct Target: Identifiable { |
| 12 | + |
| 13 | + /** |
| 14 | + * Initializes a target with parameters |
| 15 | + * - Parameter id: The unique identifier of the target set by the extension |
| 16 | + * - Parameter displayName: The name of the target to be displayed in the UI |
| 17 | + * - Parameter executable: The executable to launch inside the pseudo terminal |
| 18 | + * - Parameter args: an array of strings that is passed as the arguments to the underlying process |
| 19 | + * - Parameter environment: an array of environment variables to pass to the child process. |
| 20 | + * - Parameter execName: If provided, this is used as the Unix argv[0] parameter, otherwise, the executable is used as the args [0], this is used when the intent is to set a different process name than the file that backs it. |
| 21 | + */ |
| 22 | + public init(id: String, displayName: String, |
| 23 | + executable: String, args: [String] = [], |
| 24 | + environment: [String]? = nil, execName: String? = nil) { |
| 25 | + self.id = id |
| 26 | + self.displayName = displayName |
| 27 | + self.executable = executable |
| 28 | + self.args = args |
| 29 | + self.environment = environment |
| 30 | + self.execName = execName |
| 31 | + } |
| 32 | + |
| 33 | + /// ``id`` is a unique identifier of the target set by the extension |
| 34 | + public var id: String |
| 35 | + |
| 36 | + /// ``displayName`` is a name to be displayed in the UI to represent target |
| 37 | + public var displayName: String |
| 38 | + |
| 39 | + /// ``executable`` is the executable to launch inside the pseudo terminal |
| 40 | + public var executable: String |
| 41 | + |
| 42 | + /// ``args`` is an array of strings that is passed as the arguments to the underlying process |
| 43 | + public var args: [String] = [] |
| 44 | + |
| 45 | + /// ``environment`` is an array of environment variables to pass to the child process. |
| 46 | + public var environment: [String]? |
| 47 | + |
| 48 | + /// ``execName`` If provided, this is used as the Unix argv[0] parameter, otherwise, the executable is used as the args [0], this is used when the intent is to set a different process name than the file that backs it. |
| 49 | + public var execName: String? |
| 50 | +} |
0 commit comments