Skip to content

Commit

Permalink
Merge pull request #51 from mono0926/50--suppress-opening-directory
Browse files Browse the repository at this point in the history
Add `--suppress-opening-directory` flag
  • Loading branch information
mono0926 authored May 17, 2017
2 parents 81a5bea + 6f6073c commit fe217bc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ You can see options by `license-plist --help`.

<img src="https://cloud.githubusercontent.com/assets/1255062/25931869/f15d2df2-3649-11e7-8c7d-bb37d11adca0.png" width="320" height="568" alt="License list with versions">

#### `--suppress-opening-directory`

- Default: false
- Only when the files are created or updated, the terminal or the finder opens. By adding `--suppress-opening-directory` flag, this behavior is suppressed.

### Integrate into build

Add `Run Script` to `Build - Pre-actions`:
Expand Down
6 changes: 5 additions & 1 deletion Sources/LicensePlist/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ let main = command(Option("cartfile-path", Consts.cartfileName),
Option("github-token", ""),
Option("config-path", Consts.configPath),
Flag("force"),
Flag("add-version-numbers")) { cartfile, podsPath, output, gitHubToken, configPath, force, version in
Flag("add-version-numbers"),
Flag("suppress-opening-directory")) {
cartfile, podsPath, output, gitHubToken, configPath, force, version, suppressOpeningDirectory in

Logger.configure()
var config = loadConfig(configPath: URL(fileURLWithPath: configPath))
config.force = force
config.addVersionNumbers = version
config.suppressOpeningDirectory = suppressOpeningDirectory
let options = Options(outputPath: URL(fileURLWithPath: output),
cartfilePath: URL(fileURLWithPath: cartfile),
podsPath: URL(fileURLWithPath: podsPath),
Expand Down
2 changes: 1 addition & 1 deletion Sources/LicensePlistCore/Consts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public struct Consts {
public static let prefix = "com.mono0926.LicensePlist"
public static let outputPath = "\(prefix).Output"
public static let configPath = "license_plist.yml"
public static let version = "1.3.7"
public static let version = "1.3.8"
public static let encoding = String.Encoding.utf8
}
1 change: 1 addition & 0 deletions Sources/LicensePlistCore/Entity/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public struct Config {
let renames: [String: String]
public var force = false
public var addVersionNumbers = false
public var suppressOpeningDirectory = false

public static let empty = Config(githubs: [], excludes: [], renames: [:])

Expand Down
4 changes: 3 additions & 1 deletion Sources/LicensePlistCore/LicensePlist.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public final class LicensePlist {
Log.info("End")
info.reportMissings()
info.finish()
Shell.open(options.outputPath.path)
if !options.config.suppressOpeningDirectory {
Shell.open(options.outputPath.path)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/LicensePlistTests/Entity/PlistInfoTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class PlistInfoTests: XCTestCase {
target.compareWithLatestSummary()

XCTAssertEqual(target.summary,
"add-version-numbers: false\n\nLicensePlist Version: 1.3.7")
"add-version-numbers: false\n\nLicensePlist Version: 1.3.8")
XCTAssertNotNil(target.summaryPath)
}

Expand Down

0 comments on commit fe217bc

Please sign in to comment.