indentpy
Python script to change indentations of files.
Dependencies
This package requires the following programs to be installed:
Installation
The installation can be done by cloning this Github repository and running the ./install.sh script.
Cloning the Github repository:
git clone https://github.com/Thijsvanede/indentpy.git
Installing the script:
chmod +x ./install.sh
./install.sh
Usage
The python script can be used in several ways:
- As a command line program after installation.
- As a command line program from source.
- As a python library.
For all use cases we give a usage example.
Inputting special characters
When you wish to specify special characters like \t or \n, these can be put into a bash terminal by the combination ctrl+v followed by the key for that character. Examples:
\t:ctrl+vfollowed bytab\n:ctrl+vfollowed byenter\r\n:ctrl+vfollowed bycrtl+rfollowed byctrl+vfollowed byenter
Command-line (Installed)
The usage of indent is explained in the help file below.
Usage: indent [-h] [-w WRITE] [-o ORIG] [-t TO] [-d DELIM] file [file ...]
Change indentation of file(s).
positional arguments:
file File(s) for which to change indentation.
optional arguments:
-h Show this help text.
-d Line delimiter in original file (optional, default='\n').
-o Indentation style in original file (optional, default='\t').
-t Indentation style in desired file (optional, default=' ').
-w File to write output to (optional, default writes to inputfile).
Example
The following example takes infile.py, transforms the original \t indentation to 4 spaces and finally writes it to outfile.py.
indent -w outfile.py -o ' ' -t ' ', infile.py
Command-line (From source)
To run the program from source, you can use both Python 2 and Python 3. The usage of indent/indent.py is explained in the help file below.
usage: indent.py [-h] [-w WRITE] [-o ORIG] [-t TO] [-d DELIM] file [file ...]
Indentation change tool.
positional arguments:
file File(s) for which to change indentation.
optional arguments:
-h, --help show this help message and exit
-w WRITE, --write WRITE File to write output to (optional, if none is given,
change contents of file.
-o ORIG, --orig ORIG Indentation style in original file (optional, if none
is given, use '\t').
-t TO, --to TO Indentation style in desired file (optional, if none
is given, use 4 spaces).
-d DELIM, --delim DELIM Line delimiter in original file (optional, if none is
given, use '\n')
Example
The following example takes infile.py, transforms the original \t indentation to 4 spaces and finally writes it to outfile.py.
python indent/indent.py -w outfile.py -o ' ' -t ' ', infile.py
Python
TODO
Metadata
Release files for indentpy 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| indentpy-1.0.0.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| indentpy-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / indentpy-1.0.0.tar.gz
| Download URL | indentpy-1.0.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6c26525995ba0ad355dbcac47fc98b161b066a00f44763dbec50d9b72dc9711
|
|
BLAKE2b-256 checksum How to use checksums |
a4e535c1a1334d735b5da36a61ba4402c4bf752fd4d9618bb6cedc7d78c42d0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
|
Release files / indentpy-1.0.0-py3-none-any.whl
| Download URL | indentpy-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0eaa99b73586cc727ca6a7682adb919d93ea5538d38d53ebe4f348fb6a99b052
|
|
BLAKE2b-256 checksum How to use checksums |
de7d8aa2489d86ab7d6817164a98ac2cd69e3a562f589537d2cea61e13092aa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
|