Skip to content

Commit

Permalink
Formatter toggling
Browse files Browse the repository at this point in the history
  • Loading branch information
lovesegfault committed Jun 13, 2017
1 parent 9f9623b commit 794d69a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ in which case it will beautify each one of the files.

Available flags are:

|Flag |Short|Meaning |Usage|
| ------------- | ---- | ---------------------------------------- |----------|
|`--files` |`-f` |Files to beautify |`-f foo.sh bar.sh`|
|`--indent-size`|`-i` |Number of spaces to use as indentation|`-i 4`|
|`--backup` |`-b` |Create a backup file before beautifying |`-b`|
| `--tab` |`-t` |Use tabs instead of spaces | `-t` |
| Flag | Short | Meaning | Usage |
| --------------- | ----- | ------------------------------------------ |------------------- |
| `--files` | `-f` | Files to beautify | `-f foo.sh bar.sh` |
| `--indent-size` | `-i` | Number of spaces to use as indentation | `-i 4` |
| `--backup` | `-b` | Create a backup file before beautifying | `-b` |
| `--tab` | `-t` | Use tabs instead of spaces | `-t` |

You can use `-` as an argument to `-f` and beautysh will use stdin as it's
source and stdout as it's sink
Expand Down Expand Up @@ -123,7 +123,7 @@ x23LimitStringx23
fi
```

Special comments '@formatter:off' and '@formatter:on' can be used to disable formatting around a block of statements.
Special comments `@formatter:off` and `@formatter:on` are available to disable formatting around a block of statements.

```shell
# @formatter:off
Expand All @@ -133,7 +133,9 @@ command \
--option3 \
# @formatter:on

This is modeled after the Eclipse feature.
```
This takes inspiration from the Eclipse feature.

________________________________________________________________________________

Originally written by [Paul Lutus](http://arachnoid.com/python/beautify_bash_program.html)
22 changes: 19 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Available flags are:
+---------------------+----------+-------------------------------------------+------------------------+
| ``--backup`` | ``-b`` | Create a backup file before beautifying | ``-b`` |
+---------------------+----------+-------------------------------------------+------------------------+
| ``--tab`` | ``-t`` | Use tabs instead of spaces | ``-t`` |
+---------------------+----------+-------------------------------------------+------------------------+

You can use ``-`` as an argument to ``-f`` and beautysh will use stdin
as it's source and stdout as it's sink
Expand Down Expand Up @@ -98,9 +100,9 @@ As well as the more obvious example:
**CAUTION**: Because Beautysh overwrites all the files submitted to
it, this could have disastrous consequences if the files include
some of the increasingly common Bash scripts that have appended
binary content (a regime where Beautysh has undefined behavior ). So
please — back up your files, and don't treat Beautysh as a harmless
utility. Even if that is true most of the time.
binary content (a regime where Beautysh has undefined behaviour ).
So please — back up your files, and don't treat Beautysh as a
harmless utility. Even if that is true most of the time.
Beautysh handles Bash here-docs with care(and there are probably some
border cases it doesn't handle). The basic idea is that the originator
Expand Down Expand Up @@ -130,6 +132,20 @@ here-doc content unchanged:
fi
Special comments ``@formatter:off`` and ``@formatter:on`` are available
to disable formatting around a block of statements.
.. code:: shell
# @formatter:off
command \
--option1 \
--option2 \
--option3 \
# @formatter:on
This takes inspiration from the Eclipse feature.
--------------
Originally written by `Paul
Expand Down
2 changes: 1 addition & 1 deletion beautysh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

from .beautysh import Beautify

__version__ = '3.1'
__version__ = '3.3'

0 comments on commit 794d69a

Please sign in to comment.