Skip to content

Commit

Permalink
Merge pull request #3 from el-hoshino/feature/SwiftPM
Browse files Browse the repository at this point in the history
Install from Mint support
  • Loading branch information
Elvis Shi authored Dec 5, 2019
2 parents 46a3940 + 9095e9e commit f21c3ee
Show file tree
Hide file tree
Showing 13 changed files with 487 additions and 151 deletions.
28 changes: 28 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "hanako",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.executable(
name: "hanako",
targets: ["hanako"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "hanako",
dependencies: []),
.testTarget(
name: "hanakoTests",
dependencies: ["hanako"]),
]
)
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
# hanako

Hanako is a command-line tool for macOS to generate a random password.

# How to build
Use archive function from your Xcode application, or just compile the main.swift file like the following line:
`$ swiftc -o hanako main.swift`
After the binary file generated, put the binary file to /usr/local/bin so that you can always use it from anywhere in terminal.
# How to install

## Using Mint

0. [Mint](https://github.com/yonaskolb/Mint) is a package manager that installs and runs Swift CLI packages. If you haven't installed it yet, install it first.
1. Install hanako via mint terminal command: `$ mint install el-hoshino/hanako`.
2. Done!

## Manually

1. Archive `hanako` target from your Xcode application.
2. After the binary file generated, put the binary file to /usr/local/bin or anywhere you have set as bash path so that you can always use it from anywhere in terminal.

# Usage

`$ hanako [options]`

# Options

- -h / --help: Help. (This will ignore all other arguments and won't perform any output.)
- -v / --version: Print version number. (This will ignore all other arguments and won't perform any output.)
- -nu / --no-uppercase: Don't use uppercased string for the output.
Expand All @@ -20,12 +31,23 @@ After the binary file generated, put the binary file to /usr/local/bin so that y
- -hf [frequency] / --hyphen-frequency [frequency]: Insert a hyphen after every certain characters. Replace [frequncy] with a number. e.g.: abc-def-ghi if you set frequency to 3, abcdefghi if you set frequncy to 0. Default frequency is 0, and hyphens are also counted in the length.

# Release Notes

## 1.0.4

- Support Mint

## 1.0.3

- Support Xcode 10.2

## 1.0.2

- Add a version number checking parameter.
- README.md update.

## 1.0.1

- README.md update.

## 1.0.0
Initial release
Initial release
File renamed without changes.
7 changes: 7 additions & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import XCTest

import hanakoTests

var tests = [XCTestCaseEntry]()
tests += hanakoTests.allTests()
XCTMain(tests)
9 changes: 9 additions & 0 deletions Tests/hanakoTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest

#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(hanakoTests.allTests),
]
}
#endif
14 changes: 14 additions & 0 deletions Tests/hanakoTests/hanakoTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import XCTest
@testable import hanako

final class hanakoTests: XCTestCase {
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
}

static var allTests = [
("testExample", testExample),
]
}
25 changes: 25 additions & 0 deletions hanako.xcodeproj/hanakoTests_Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
26 changes: 26 additions & 0 deletions hanako.xcodeproj/hanako_Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
Loading

0 comments on commit f21c3ee

Please # to comment.