Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beaglefoot/prettier-plugin-awk
AWK plugin for Prettier code formatter
https://github.com/beaglefoot/prettier-plugin-awk
awk formatter gawk prettier
Last synced: 3 months ago
JSON representation
AWK plugin for Prettier code formatter
- Host: GitHub
- URL: https://github.com/beaglefoot/prettier-plugin-awk
- Owner: Beaglefoot
- License: mit
- Created: 2021-12-19T16:38:53.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-01-27T19:01:35.000Z (12 months ago)
- Last Synced: 2024-10-09T22:21:29.007Z (3 months ago)
- Topics: awk, formatter, gawk, prettier
- Language: TypeScript
- Homepage:
- Size: 228 KB
- Stars: 14
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Prettier AWK Plugin
[![tests](https://github.com/Beaglefoot/prettier-plugin-awk/actions/workflows/tests.yml/badge.svg)](https://github.com/Beaglefoot/prettier-plugin-awk/actions/workflows/tests.yml)
[![npm](https://img.shields.io/npm/v/prettier-plugin-awk)](https://www.npmjs.com/package/prettier-plugin-awk)An opinionated formatter for AWK language built as a plugin for [Prettier](https://github.com/prettier/prettier) with help of [tree-sitter](https://github.com/tree-sitter/tree-sitter) and [tree-sitter-awk](https://github.com/Beaglefoot/tree-sitter-awk).
## How to install and use
### Globally
```
npm install --global prettier@^2 prettier-plugin-awk
```Then run:
```
prettier --write /path/to/your/awesome_script.awk
```### Per project
First you need to init new node project with:
```
npm init -y
```Then add development dependencies:
```
npm add --save-dev prettier@^2 prettier-plugin-awk
```Then run with:
```
npx prettier --write ./awesome_script.awk
```You can then create pre-commit hook with something like [husky](https://github.com/typicode/husky) or incorporate such check as CI step.
## Ignoring Code
To ignore node in a syntax tree prepend it with `# prettier-ignore` comment like this:
```awk
# prettier-ignore
BEGIN{x=12}
```[More in official docs](https://prettier.io/docs/en/ignore.html)
## Configuring
Although most of the options are unsupported or make no sense in regard to AWK you can still configure tab or print width.
To do so create `.prettierrc` in your project directory with following content:
```
{
"printWidth": 80,
"tabWidth": 4
}
```[More in official docs](https://prettier.io/docs/en/options.html)