Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dawnbeen/c_formatter_42
C language formatter for 42 norminette
https://github.com/dawnbeen/c_formatter_42
Last synced: 2 months ago
JSON representation
C language formatter for 42 norminette
- Host: GitHub
- URL: https://github.com/dawnbeen/c_formatter_42
- Owner: dawnbeen
- License: gpl-3.0
- Created: 2020-10-02T02:14:24.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-05T11:42:08.000Z (over 1 year ago)
- Last Synced: 2024-07-31T04:57:15.200Z (6 months ago)
- Language: Python
- Size: 4.43 MB
- Stars: 152
- Watchers: 6
- Forks: 16
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-42 - C Formatter 42 - Prettier for C at 42. (Tools / Campus specific)
README
# c_formatter_42
C language prettier that conforms to 42 norm v3.
I know you are already a good human norm.
It's just for convenience.## Installation
Requires Python3.8+ (3.9, 3.10, 3.11)
### From PyPI
```console
pip3 install c-formatter-42
pip3 install --user c-formatter-42 # If you don't have root privileges
```### From source
```console
git clone https://github.com/cacharle/c_formatter_42
cd c_formatter_42
pip3 install -e .
```## Usage
### Command line
```console
c_formatter_42 < file.c
python3 -m c_formatter_42 < file.c # If you get 'command not found' with the previous onec_formatter_42 --help
usage: c_formatter_42 [-h] [-c] [FILE [FILE ...]]Format C source according to the norm
positional arguments:
FILE File to format inplace, if no file is provided read STDINoptional arguments:
-h, --help show this help message and exit
-c, --confirm Ask confirmation before overwriting any file
```## Plugins / Extensions
### Vim
Check out the [`c_formatter_42.vim`](https://github.com/cacharle/c_formatter_42.vim) plugin. This plugin automatically installs the `c_formatter_42` package using pip.
### Visual Studio Code
1. Install `c_formatter_42`
1. Install the [`keyhr.42-c-format`](https://marketplace.visualstudio.com/items?itemName=keyhr.42-c-format) extension
1. Set `keyhr.42-c-format` as the default formatter for C files in `.vscode/settings.json````json
{
"[c]": {
"editor.defaultFormatter": "keyhr.42-c-format"
}
}
```## Contributing
Feel free to report issues or contribute. :)
### Run the tests
```
pip3 install tox
tox
tox -e py311 # for a specific python version
```### Deploy a new version
```
pip3 install bumpversion
bumpversion [major|minor|patch]
git push
git push --tags
```Go to: and click on the tag you just created.
Then click on `Create release from tag`, the pipeline will build and deploy that version for you.