Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add overwrite option to mint bootstrap #193

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#### Added
- Added `--overwrite` option to `mint install` [#186](https://github.com/yonaskolb/Mint/pull/186) @Econa77
- Added `--overwrite` option to `mint bootstrap` [#193](https://github.com/yonaskolb/Mint/pull/193) @Econa77

## 0.15.0

Expand Down
5 changes: 4 additions & 1 deletion Sources/MintCLI/Commands/BootstrapCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import SwiftCLI

class BootstrapCommand: MintfileCommand {

@Key("-o", "--overwrite", description: "Automatically overwrite a symlinked executable that is not installed by mint without asking. Either (y/n)")
var overwrite: Bool?

init(mint: Mint) {
super.init(mint: mint,
name: "bootstrap",
Expand All @@ -14,6 +17,6 @@ class BootstrapCommand: MintfileCommand {

override func execute() throws {
try super.execute()
try mint.bootstrap(link: link)
try mint.bootstrap(link: link, overwrite: overwrite)
}
}
4 changes: 2 additions & 2 deletions Sources/MintKit/Mint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public class Mint {
output(confirmation.green)
}

public func bootstrap(link: Bool = false) throws {
public func bootstrap(link: Bool = false, overwrite: Bool? = nil) throws {

let mintFile = try Mintfile(path: mintFilePath)

Expand All @@ -477,7 +477,7 @@ public class Mint {
}
var installCount = 0
for package in mintFile.packages {
let installed = try install(package: package, beforeOtherCommand: true, force: false, link: link)
let installed = try install(package: package, beforeOtherCommand: true, force: false, link: link, overwrite: overwrite)
if installed {
installCount += 1
}
Expand Down