Skip to content

Commit

Permalink
Add Keychain
Browse files Browse the repository at this point in the history
  • Loading branch information
onmyway133 committed Feb 17, 2022
1 parent 9dfbefa commit 4a85b06
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion Examples/CLI/CLI/Script.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ struct Script {
)
}
}

6 changes: 4 additions & 2 deletions Sources/Swiftlane/Actions/iOS/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public struct Keychain {
}

var args = Args()
args["create-keychain"] = path.rawValue.path.surroundingWithQuotes()
args.flag("create-keychain")
args["-p"] = password.surroundingWithQuotes()
args.suffix = [path.rawValue.path.surroundingWithQuotes()]

try Settings.cli.run(
program: "security",
Expand All @@ -47,8 +48,9 @@ public struct Keychain {

public func unlock() async throws {
var args = Args()
args["unlock-keychain"] = path.rawValue.path.surroundingWithQuotes()
args.flag("unlock-keychain")
args["-p"] = password.surroundingWithQuotes()
args.suffix = [path.rawValue.path.surroundingWithQuotes()]

try Settings.cli.run(
program: "security",
Expand Down
3 changes: 2 additions & 1 deletion Sources/Swiftlane/Library/Core/Args.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
public struct Args {
private var map: [String: String] = [:]
private var mapMultiple: [String: Set<String>] = [:]
public var suffix: [String] = []

public subscript(_ key: String) -> String? {
get {
Expand Down Expand Up @@ -73,7 +74,7 @@ public struct Args {
.sorted(by: sortArguments)
.joined(separator: " ")

return [mapString, mapMultipleString].joined(separator: " ")
return ([mapString, mapMultipleString] + suffix).joined(separator: " ")
}

// Ensure non-hyphen arguments come first
Expand Down

0 comments on commit 4a85b06

Please sign in to comment.