https://github.com/nochso/ctxerr
ctxerr is a Go library for printing pretty parser errors.
https://github.com/nochso/ctxerr
Last synced: 10 months ago
JSON representation
ctxerr is a Go library for printing pretty parser errors.
- Host: GitHub
- URL: https://github.com/nochso/ctxerr
- Owner: nochso
- License: mit
- Created: 2016-12-29T16:16:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-22T22:31:24.000Z (over 9 years ago)
- Last Synced: 2024-06-20T15:03:02.630Z (almost 2 years ago)
- Language: Go
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
ctxerr
======
[](LICENSE)
[](https://godoc.org/github.com/nochso/ctxerr)
[](https://github.com/nochso/ctxerr/releases)
[](https://goreportcard.com/report/github.com/nochso/ctxerr)
[](https://travis-ci.org/nochso/ctxerr)
[](https://coveralls.io/github/nochso/ctxerr?branch=master)
**ctxerr** is a [Go][] library and CLI utility for pretty-printing linter/parser errors.
Instead of just describing what's wrong, it lets you point at the wrong input:
```
narf.txt:1:8: string is missing closing quote
1 | "foo bar
| ^ missing closing quote
```
- Create pretty error messages for linters, parsers, etc. by pointing at the
relevant position in the source code.
- Parse existing error messages into `Ctx` structs.
- CLI utility `ctx` scans STDIN for linter errors and enhances them with the
reported source line.
---
- [Installation](#installation)
- [Documentation](#documentation)
- [Changes](#changes)
- [License](#license)
Installation
------------
### Library
```bash
go get -u github.com/nochso/ctxerr
```
### CLI utility `ctx`
```bash
go install github.com/nochso/ctxerr/cmd/ctx
```
Documentation
-------------
### Library
The [GoDoc](https://godoc.org/github.com/nochso/ctxerr) pages contain plenty
of examples.
### CLI utility `ctx`
```shell
$ ctx -h
ctx 1.0.0-beta
Pretty prints parser errors from stdin.
Possible input:
path/file.ext:1:5: some error on line 1, column 5
file.ext:123: column is optional and so is the message:
file.ext:1
Usage:
ctx < log.txt
gometalinter . | ctx
Flags:
-context NUM
print NUM lines of context surrounding an error. negative for all, positive for limited and 0 for none (default)
-no-color
disable any color output
-pessimistic
print only matching errors, ignore everything else
```
Changes
-------
All notable changes to this project will be documented in the [changelog].
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this
project adheres to [Semantic Versioning](http://semver.org/).
License
-------
This project is released under the [MIT license](LICENSE).
[changelog]: CHANGELOG.md
[releases]: https://github.com/nochso/ctxerr/releases
[Go]: https://golang.org