https://github.com/lovasko/tw
Trailing Whitespace Detector
https://github.com/lovasko/tw
Last synced: about 1 year ago
JSON representation
Trailing Whitespace Detector
- Host: GitHub
- URL: https://github.com/lovasko/tw
- Owner: lovasko
- License: bsd-3-clause
- Created: 2016-06-19T01:04:38.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-31T17:18:17.000Z (over 9 years ago)
- Last Synced: 2025-04-17T11:55:35.868Z (about 1 year ago)
- Language: Haskell
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tw
[]
(https://travis-ci.org/lovasko/tw)
Trailing whitespace detector `tw` command-line utility scans a set of
files and tests each line of each file for whitespace characters at its
end. The utility processes only a limited set of characters at a time and
therefore can be used with files that contain arbitrarily many lines.
## Usage
The utility accepts zero or more arguments: when the argument count is
zero, `stdin` is used, otherwise the arguments are used as paths to the
files.
### Synopsis
```
tw [FILE ...]
```
## Return code
The `tw` utility returns `1` if any lines with trailing whitespace in any
of the files were found, `0` otherwise.
## Example
Following example examines all standard library C header files that were
shipped with the FreeBSD operating system version 10.0. Apparently,
`stdlib.h` contains one line with trailing whitespace, which is further
proved by a small `sed` script that quotes the incriminated line:
```sh
$ freebsd-version
10.0-RELEASE
$ tw /usr/include/std*.h
/usr/include/stdlib.h: 258
$ echo $?
1
$ sed -n '258s/\(.*\)/"\1"/p' /usr/include/stdlib.h
"__uint32_t "
```
## Build
To compile and run the utility, use the following commands:
```sh
$ stack build --pedantic
$ stack exec tw /path/to/file
```
## License
The source code is licensed under the 3-clause BSD license (for more
information please consult the [LICENSE](LICENSE.md) file). In case you
need a different license, feel free to contact the author.
## Author
Daniel Lovasko