Skip to content

Commit

Permalink
Rewriting everything.
Browse files Browse the repository at this point in the history
  • Loading branch information
RockfordWei committed Dec 14, 2017
1 parent 1df1ed0 commit d2f1453
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 195 deletions.
19 changes: 18 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
//
// Package.swift
// Perfect-INIParser
Expand All @@ -20,5 +22,20 @@
import PackageDescription

let package = Package(
name: "INIParser"
name: "INIParser",
products: [
.library(
name: "INIParser",
targets: ["INIParser"]),
],
dependencies: [
],
targets: [
.target(
name: "INIParser",
dependencies: []),
.testTarget(
name: "INIParserTests",
dependencies: ["INIParser"]),
]
)
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<p align="center">
<a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat" alt="Swift 4.0">
<img src="https://img.shields.io/badge/Swift-3.1-orange.svg?style=flat" alt="Swift 3.1">
</a>
<a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Platforms-OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat" alt="Platforms OS X | Linux">
Expand All @@ -42,22 +41,14 @@

This project provides an express parser for [INI](https://en.wikipedia.org/wiki/INI_file) files.

This package builds with Swift Package Manager of Swift 3.1 Tool Chain and is part of the [Perfect](https://github.com/PerfectlySoft/Perfect) project but can be used as an independent module.
This package builds with Swift Package Manager of Swift 4 Tool Chain and is part of the [Perfect](https://github.com/PerfectlySoft/Perfect) project but can be used as an independent module.

## Quick Start

Configure Package.swift:

For Swift 3.1:

``` swift
.Package(url: "https://github.com/PerfectlySoft/Perfect-INIParser.git", majorVersion: 1)
```

For Swift 4.0:

``` swift
.package(url: "https://github.com/PerfectlySoft/Perfect-INIParser.git", from: "1.0.0")
.package(url: "https://github.com/PerfectlySoft/Perfect-INIParser.git", from: "3.0.0")

...

Expand Down Expand Up @@ -89,7 +80,7 @@ For most regular lines under a certain section, use `sections` attribute of `INI
myVariable = myValue
```

Then `let v = ini.sections["[GroupA]"]?["myVariable"]` will get the value as `"myValue"`.
Then `let v = ini.sections["GroupA"]?["myVariable"]` will get the value as `"myValue"`.

### Variables without Section

Expand Down
15 changes: 3 additions & 12 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<p align="center">
<a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat" alt="Swift 4.0">
<img src="https://img.shields.io/badge/Swift-3.1-orange.svg?style=flat" alt="Swift 3.1">
</a>
<a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Platforms-OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat" alt="Platforms OS X | Linux">
Expand All @@ -42,22 +41,14 @@

本项目是一个简单的[INI文件](http://baike.baidu.com/item/ini文件)解析器。

本项目采用Swift 3.1 工具链中的SPM软件包管理器编译,是[Perfect](https://github.com/PerfectlySoft/Perfect) 项目的一部分,但也可以作为独立模块使用。
本项目采用Swift 4 工具链中的SPM软件包管理器编译,是[Perfect](https://github.com/PerfectlySoft/Perfect) 项目的一部分,但也可以作为独立模块使用。

## 快速上手

配置 Package.swift 文件:

如果使用 Swift 3.1:

``` swift
.Package(url: "https://github.com/PerfectlySoft/Perfect-INIParser.git", majorVersion: 1)
```

如果使用 Swift 4.0:

``` swift
.package(url: "https://github.com/PerfectlySoft/Perfect-INIParser.git", from: "1.0.0")
.package(url: "https://github.com/PerfectlySoft/Perfect-INIParser.git", from: "3.0.0")

...

Expand Down Expand Up @@ -89,7 +80,7 @@ let ini = try INIParser("/path/to/somefile.ini")
myVariable = myValue
```

此时使用语句 `let v = ini.sections["[GroupA]"]?["myVariable"]` 可以得到字符串值 `"myValue"`.
此时使用语句 `let v = ini.sections["GroupA"]?["myVariable"]` 可以得到字符串值 `"myValue"`.

### 无章节变量

Expand Down
156 changes: 0 additions & 156 deletions Sources/INIParser.swift

This file was deleted.

Loading

0 comments on commit d2f1453

Please sign in to comment.