diff --git a/Sources/Swiftly/Install.swift b/Sources/Swiftly/Install.swift index fb43e690..74c0c19b 100644 --- a/Sources/Swiftly/Install.swift +++ b/Sources/Swiftly/Install.swift @@ -69,7 +69,7 @@ struct Install: SwiftlyCommand { written to this file as commands that can be run after the installation. """ )) - var postInstallFile: String? + var postInstallFile: FilePath? @OptionGroup var root: GlobalOptions @@ -156,7 +156,7 @@ struct Install: SwiftlyCommand { } try Data(postInstallScript.utf8).write( - to: FilePath(postInstallFile), options: .atomic + to: postInstallFile, options: .atomic ) } } diff --git a/Sources/Swiftly/Swiftly.swift b/Sources/Swiftly/Swiftly.swift index a482fa11..71794236 100644 --- a/Sources/Swiftly/Swiftly.swift +++ b/Sources/Swiftly/Swiftly.swift @@ -10,6 +10,16 @@ import SystemPackage typealias fs = SwiftlyCore.FileSystem +extension FilePath: ExpressibleByArgument { + public init?(argument: String) { + self.init(argument) + } + + public static var defaultCompletionKind: CompletionKind { + CompletionKind.file() + } +} + public struct GlobalOptions: ParsableArguments { @Flag(name: [.customShort("y"), .long], help: "Disable confirmation prompts by assuming 'yes'") var assumeYes: Bool = false diff --git a/Sources/Swiftly/Update.swift b/Sources/Swiftly/Update.swift index ff097f74..38cf4c1c 100644 --- a/Sources/Swiftly/Update.swift +++ b/Sources/Swiftly/Update.swift @@ -72,7 +72,7 @@ struct Update: SwiftlyCommand { written to this file as commands that can be run after the installation. """ )) - var postInstallFile: String? + var postInstallFile: FilePath? private enum CodingKeys: String, CodingKey { case toolchain, root, verify, postInstallFile @@ -138,7 +138,7 @@ struct Update: SwiftlyCommand { """) } - try Data(postInstallScript.utf8).write(to: FilePath(postInstallFile), options: .atomic) + try Data(postInstallScript.utf8).write(to: postInstallFile, options: .atomic) } if pathChanged {