Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tal7aouy/indent
⚡️ PHP Library helps detect and convert indentation in strings and files to a spaces or tabs.
https://github.com/tal7aouy/indent
indent indentation php php-library
Last synced: 5 days ago
JSON representation
⚡️ PHP Library helps detect and convert indentation in strings and files to a spaces or tabs.
- Host: GitHub
- URL: https://github.com/tal7aouy/indent
- Owner: tal7aouy
- License: mit
- Created: 2022-03-22T11:26:55.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-22T11:30:30.000Z (almost 3 years ago)
- Last Synced: 2024-12-07T22:37:42.716Z (26 days ago)
- Topics: indent, indentation, php, php-library
- Language: PHP
- Homepage: https://packagist.org/packages/tal7aouy/indent
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
indent
======**Library to detect and convert indentation in strings and files**, Tabs to spaces or vice versa.
⚡️ Installation
------------Install via [composer](https://packagist.org/packages/tal7aouy/indent) or just clone the repo.
### Global installation
Install it globally using:
composer global require tal7aouy/indent
✅ Usage
```sh
./indent
```
-----indent [--tabs|--spaces] [-r [--pattern=...]] [files or directories...]
--tabs convert all indentation to tabs. Assuming 4 spaces tab length.
--spaces convert all indentation to spaces.-r recursively go over all directories given as argument and convert
files that match --pattern.--pattern the pattern to match files for when using -r. Defaults to '*.php'.
--tabstop=N define number of spaces N to replace a tab with. Defaults to 4.
--help shows this usage information.
If no file is specified input will be read from STDIN.
🚀 Examples
--------Convert STDIN, which is the content of `index.php` to spaces and print the result to STDOUT:
cat index.php | ./indent --spaces
Convert `index.php` to tabs:
indent --tabs index.php
Convert all `.php`-files and the `LICENSE.md` in current dir to spaces:
indent --spaces *.php LICENSE.md
Convert all `.php`-files in `dir` to tabs (recursively):
indent --tabs -r dir
Convert all `.md`-files in dir to spaces (recursively):
indent --spaces --pattern=*.md -r dir
**indent** was created by **[tal7aouy](https://github.com/tal7aouy)** under the **[MIT license](https://opensource.org/licenses/MIT)**.