Skip to content

Commit e942e40

Browse files
committed
Update README. Bump version.
1 parent 7ed2e7a commit e942e40

File tree

3 files changed

+34
-20
lines changed

3 files changed

+34
-20
lines changed

README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
1-
# *nginx* config file formatter
1+
# *nginx* config file formatter/beautifier
22

3-
This Python script formats *nginx* configuration files in consistent way, described below:
3+
*nginx* config file formatter/beautifier written in Python with no additional dependencies. It can be used as library or standalone script. It formats *nginx* configuration files in consistent way, described below:
4+
5+
* All lines are indented in uniform manner, with 4 spaces per level. Number of spaces is customizable.
6+
* Neighbouring empty lines are collapsed to at most two empty lines.
7+
* Curly braces placement follows Java convention.
8+
* Whitespaces are collapsed, except in comments and quotation marks.
49

5-
* all lines are indented in uniform manner, with 4 spaces per level
6-
* neighbouring empty lines are collapsed to at most two empty lines
7-
* curly braces placement follows Java convention
8-
* whitespaces are collapsed, except in comments and quotation marks
910

1011
## Installation
1112

12-
Python 3.4 or later is needed to run this program. The simplest form of installation would be copying `nginxfmt.py` to
13-
your scripts directory.
13+
Python 3.4 or later is needed to run this program. The easiest way is to download package from PyPI:
14+
15+
```bash
16+
pip3 install nginxfmt
17+
```
18+
19+
20+
### Manual installation
21+
22+
The simplest form of installation would be copying `nginxfmt.py` to
23+
your scripts directory. It has no 3-rd party dependencies.
1424

1525
You can also clone the repository and symlink the executable:
1626

@@ -20,7 +30,11 @@ git clone https://github.com/slomkowski/nginx-config-formatter.git
2030
ln -s ~/nginx-config-formatter/nginxfmt.py ~/bin/nginxfmt.py
2131
```
2232

23-
## Usage
33+
34+
## Usage as standalone script
35+
36+
It can format one or several files. Result is by default saved to the original file, but can be redirected to *stdout*.
37+
It can also function in piping mode, with `--pipe` switch.
2438

2539
```
2640
usage: nginxfmt.py [-h] [-v] [-] [-p | -b] [-i INDENT] [config_files ...]
@@ -43,6 +57,7 @@ formatting options:
4357
specify number of spaces for indentation
4458
```
4559

60+
4661
## Using as library
4762

4863
Main logic is within `Formatter` class, which can be used in 3rd-party code.
@@ -75,6 +90,7 @@ fo.indentation = 2 # 2 spaces instead of default 4
7590
f = nginxfmt.Formatter(fo)
7691
```
7792

93+
7894
## Reporting bugs
7995

8096
Please create issue under https://github.com/slomkowski/nginx-config-formatter/issues. Be sure to add config snippets to
@@ -84,6 +100,7 @@ reproduce the issue, preferably:
84100
* actual result with invalid formatting
85101
* desired result
86102

103+
87104
## Credits
88105

89-
Copyright 2021 Michał Słomkowski. License: Apache 2.0.
106+
Copyright 2021 Michał Słomkowski. License: Apache 2.0. Previously published under https://github.com/1connect/nginx-config-formatter.

nginxfmt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
"""This Python script formats nginx configuration files in consistent way.
4+
"""nginx config file formatter/beautifier with no additional dependencies.
55
66
Originally published under https://github.com/1connect/nginx-config-formatter,
77
then moved to https://github.com/slomkowski/nginx-config-formatter.
@@ -18,7 +18,7 @@
1818

1919
__author__ = "Michał Słomkowski"
2020
__license__ = "Apache 2.0"
21-
__version__ = "1.2.1"
21+
__version__ = "1.2.2"
2222

2323

2424
class FormatterOptions:

pyproject.toml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
[tool.poetry]
22
name = "nginxfmt"
3-
version = "1.2.1"
4-
description = "nginx config file formatter with no additional dependencies."
5-
authors = ["Michał Słomkowski"]
6-
license = "Apache 2.0"
3+
version = "1.2.2"
4+
description = "nginx config file formatter/beautifier with no additional dependencies."
5+
authors = ["Michał Słomkowski <michal@slomkowski.eu>"]
6+
license = "Apache-2.0"
77
readme = "README.md"
88
homepage = "https://github.com/slomkowski/nginx-config-formatter"
99
repository = "https://github.com/slomkowski/nginx-config-formatter"
10-
keywords = ["nginx", "formatter"]
11-
include = [
12-
"LICENSE",
13-
]
10+
keywords = ["nginx", "formatter", "formatting", "beautifier"]
1411

1512

1613
[tool.poetry.dependencies]

0 commit comments

Comments
 (0)