Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kamilturek/go-zpl
A CLI tool & Go package for conversion of ZPL files.
https://github.com/kamilturek/go-zpl
cli converter go golang labelary zpl zpl-programming-language
Last synced: 26 days ago
JSON representation
A CLI tool & Go package for conversion of ZPL files.
- Host: GitHub
- URL: https://github.com/kamilturek/go-zpl
- Owner: kamilturek
- License: mit
- Created: 2022-08-15T17:24:33.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-08-27T12:50:25.000Z (about 2 years ago)
- Last Synced: 2024-06-21T13:03:12.476Z (5 months ago)
- Topics: cli, converter, go, golang, labelary, zpl, zpl-programming-language
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# go-zpl
A CLI tool & Go package for conversion of ZPL files.
A wrapper around [Labelary ZPL Web Service](http://labelary.com/service.html).## Installation
### CLI Tool
Using Go:
```bash
go install github.com/kamilturek/go-zpl/cmd/go-zpl@latest
```Using Homebrew:
```bash
brew install kamilturek/tap/go-zpl
```### Go package
```bash
go get github.com/kamilturek/go-zpl
```## Usage
### CLI Tool
`go-zpl` provides a help message describing all available options along with
their default values.```bash
$ go-zpl --help
Usage of go-zpl:
-d int
input label density [dpmm] (default 8)
-f string
output file format (default "png")
-h int
input label height [inch] (default 6)
-o string
output file path
-v version for go-zpl
-version
version for go-zpl
-w int
input label width [inch] (default 4)
```By default, `go-zpl` reads ZPL data from the standard input and writes result
to the standard output.```bash
$ cat hello.zpl | go-zpl -f pdf | head -n 1
%PDF-1.4
```It is possible to read ZPL data from a file and write the result to another one.
```bash
$ go-zpl -f pdf -o hello.pdf hello.zpl
$ head -n 1 hello.pdf
%PDF-1.4
```### Go package
```go
package mainimport "github.com/kamilturek/go-zpl"
func main() {
// Using convenience wrapper
zpl.ToPNG(
[]byte("^xa^cfa,50^fo100,100^fdHello World^fs^xz"),
// Optional extra configuration
zpl.WithWidth(4),
zpl.WithHeight(6),
zpl.WithDensity(8),
)// Or configuring the converter from scratch
f, _ := os.Open("hello.zpl")
zpl.Convert(
zpl.WithInput(f),
zpl.WithOutput(os.Stdout),
zpl.WithOutputFormat(zpl.PNG),
zpl.WithDensity(12),
)
}
```## License
See [LICENSE](LICENSE.md).
## Contributing
Please create a GitHub issue for any feedback, bugs, requests or issues.
PRs are also welcome.### Running tests
- General tests
```bash
go test
```- Integration tests
```bash
go test -tags=integration
```