summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Edmund Crosley <timothy.crosley@gmail.com>2019-02-24 19:17:49 -0800
committerGitHub <noreply@github.com>2019-02-24 19:17:49 -0800
commitae7f2a99b0ba7306fab56b6145391ad7659df9c2 (patch)
tree9b75bfba3c5fde3789f243d8b5504aa169fe2dd9
parentcd9b070723a9ad5503bcfc82a8ce8ce236f2ac6f (diff)
parent4246a28ebb2ed19c5634aaa544c7b35bbae88197 (diff)
downloadisort-ae7f2a99b0ba7306fab56b6145391ad7659df9c2.tar.gz
Merge pull request #825 from timothycrosley/feature/fix-issue-769
Fix documentation
-rw-r--r--README.rst17
-rw-r--r--isort/main.py6
2 files changed, 18 insertions, 5 deletions
diff --git a/README.rst b/README.rst
index 7a968720..0cbd4f1f 100644
--- a/README.rst
+++ b/README.rst
@@ -325,7 +325,20 @@ past the line_length limit and has 6 possible settings:
lib5, ...
)
-**6 - NOQA**
+**6 - Hanging Grid Grouped, No Trailing Comma**
+
+In Mode 5 isort leaves a single extra space to maintain consistency of output when a comma is added at the end.
+Mode 6 is the same - except that no extra space is maintained leading to the possibility of lines one character longer.
+You can enforce a trailing comma by using this in conjunction with `-tc` or `trailing_comma: True`.
+
+.. code-block:: python
+
+ from third_party import (
+ lib1, lib2, lib3, lib4,
+ lib5
+ )
+
+**7 - NOQA**
.. code-block:: python
@@ -532,7 +545,7 @@ From the command line:
.. code-block:: bash
- isort -r "os.system" *.py
+ isort -rm "os.system" *.py
from within Kate:
diff --git a/isort/main.py b/isort/main.py
index a47ae932..426d05e3 100644
--- a/isort/main.py
+++ b/isort/main.py
@@ -29,7 +29,7 @@ import sys
import setuptools
from isort import SortImports, __version__
-from isort.settings import DEFAULT_SECTIONS, default, from_path, should_skip
+from isort.settings import DEFAULT_SECTIONS, WrapModes, default, from_path, should_skip
INTRO = r"""
/#######################################################################\
@@ -234,7 +234,7 @@ def parse_args(argv=None):
help="Forces line endings to the specified value. If not set, values will be guessed per-file.")
parser.add_argument('-ls', '--length-sort', help='Sort imports by their string length.',
dest='length_sort', action='store_true')
- parser.add_argument('-m', '--multi-line', dest='multi_line_output', type=int, choices=[0, 1, 2, 3, 4, 5],
+ parser.add_argument('-m', '--multi-line', dest='multi_line_output', type=int, choices=range(len(WrapModes)),
help='Multi line output (0-grid, 1-vertical, 2-hanging, 3-vert-hanging, 4-vert-grid, '
'5-vert-grid-grouped, 6-vert-grid-grouped-no-comma).')
inline_args_group.add_argument('-nis', '--no-inline-sort', dest='no_inline_sort', action='store_true',
@@ -251,7 +251,7 @@ def parse_args(argv=None):
help='Force sortImports to recognize a module as being part of the current python project.')
parser.add_argument('-q', '--quiet', action='store_true', dest="quiet",
help='Shows extra quiet output, only errors are outputted.')
- parser.add_argument('-r', '--remove-import', dest='remove_imports', action='append',
+ parser.add_argument('-rm', '--remove-import', dest='remove_imports', action='append',
help='Removes the specified import from all files.')
parser.add_argument('-rc', '--recursive', dest='recursive', action='store_true',
help='Recursively look for Python files of which to sort imports')