Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/Swiftly/Install.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -156,7 +156,7 @@ struct Install: SwiftlyCommand {
}

try Data(postInstallScript.utf8).write(
to: FilePath(postInstallFile), options: .atomic
to: postInstallFile, options: .atomic
)
}
}
Expand Down
10 changes: 10 additions & 0 deletions Sources/Swiftly/Swiftly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Sources/Swiftly/Update.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down