wip
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# Getting Started
|
||||
|
||||
Learn how to integrate the plugins into your project
|
||||
|
||||
## Overview
|
||||
|
||||
Use the plugins by including as a package to your project and declaring in the `plugins` section of
|
||||
your target.
|
||||
|
||||
```swift
|
||||
let package = Package(
|
||||
...,
|
||||
dependencies: [
|
||||
...,
|
||||
.package(url: "https://github.com/m-housh/swift-git-version.git", from: "0.1.0")
|
||||
],
|
||||
targets: [
|
||||
.executableTarget(
|
||||
name: "<target name>",
|
||||
dependencies: [...],
|
||||
plugins: [
|
||||
.plugin(name: "BuildWithVersionPlugin", package: "swift-git-version")
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
The above example uses the build tool plugin. The `BuildWithVersionPlugin` will give you access
|
||||
to a `VERSION` variable in your project that you can use to supply the version of the tool.
|
||||
|
||||
### Example
|
||||
|
||||
```swift
|
||||
import ArgumentParser
|
||||
|
||||
@main
|
||||
struct MyCliTool: ParsableCommand {
|
||||
static let configuration = CommandConfiguration(
|
||||
abstract: "My awesome cli tool",
|
||||
version: VERSION
|
||||
)
|
||||
|
||||
func run() throws {
|
||||
print("Version: \(VERSION)")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You will have access to the `VERSION` string variable even though it is not declared in your source
|
||||
files.
|
||||
22
Sources/GitVersion/Documentation.docc/GitVersion.md
Normal file
22
Sources/GitVersion/Documentation.docc/GitVersion.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# ``GitVersion``
|
||||
|
||||
Derive a version for a command line tool from git tags or a git sha.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
[Github Repo](https://github.com/m-housh/swift-git-version)
|
||||
|
||||
## Overview
|
||||
|
||||
This tool exposes several plugins that can be used to derive a version for a command line program at
|
||||
build time or by manually running the plugin. The version is derived from git tags and falling back to
|
||||
the branch and git sha if a tag is not set for the current worktree state.
|
||||
|
||||
## Articles
|
||||
|
||||
- <doc:GettingStarted>
|
||||
|
||||
### Api
|
||||
|
||||
- ``FileClient``
|
||||
- ``GitVersionClient``
|
||||
Reference in New Issue
Block a user