https://github.com/digipolitan/code-writer
https://github.com/digipolitan/code-writer
base builder source-code writer
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/digipolitan/code-writer
- Owner: Digipolitan
- License: bsd-3-clause
- Created: 2017-08-16T08:44:39.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-06T20:23:41.000Z (over 6 years ago)
- Last Synced: 2025-01-17T00:20:16.516Z (4 months ago)
- Topics: base, builder, source-code, writer
- Language: Swift
- Size: 22.5 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
CodeWriter
=================================[](https://developer.apple.com/swift/)
[](https://swift.org/package-manager/)
[](http://twitter.com/Digipolitan)Helper library cross platform to write & build source code
## Installation
### SPM
To install CodeWriter with SwiftPackageManager, add the following lines to your `Package.swift`.
```swift
let package = Package(
name: "XXX",
products: [
.library(
name: "XXX",
targets: ["XXX"]),
],
dependencies: [
.package(url: "https://github.com/Digipolitan/code-writer.git", from: "1.1.0")
],
targets: [
.target(
name: "XXX",
dependencies: ["CodeWriter"])
]
)
```## The Basics
- Builders
```swift
let builder = CodeBuilder()
builder.add(line: "if test {")
.rightTab()
.add(line: "print(\"ok\")")
.leftTab()
.add(line: "}")
let res = builder.build()
print("\(res)")
```**Output**
```
if test {
print("ok")
}
```- Writers
The write interface provide the method to override in sub project
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details!
This project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code. Please report
unacceptable behavior to [[email protected]](mailto:[email protected]).## License
CodeWriter is licensed under the [BSD 3-Clause license](LICENSE).