summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/python.yml30
-rw-r--r--.github/workflows/shellcheck.yml22
-rw-r--r--Makefile4
-rw-r--r--doc/ranger.113
-rw-r--r--doc/ranger.pod8
-rw-r--r--doc/rifle.122
-rw-r--r--examples/rc_emacs.conf5
-rwxr-xr-xranger/config/commands.py6
-rw-r--r--ranger/config/rc.conf5
-rw-r--r--ranger/container/settings.py2
-rw-r--r--ranger/core/actions.py2
-rw-r--r--ranger/core/main.py10
-rwxr-xr-xranger/data/scope.sh1
13 files changed, 111 insertions, 19 deletions
diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml
new file mode 100644
index 00000000..6e872db5
--- /dev/null
+++ b/.github/workflows/python.yml
@@ -0,0 +1,30 @@
+name: Python lints and tests
+
+on:
+  push:
+    paths:
+      - '.github/workflows/python.yml'
+      - '*.py'
+
+jobs:
+  test_py:
+    runs-on: ubuntu-latest
+    strategy:
+      max-parallel: 4
+      matrix:
+        python-version: [2.7, 3.5, 3.6, 3.7]
+    steps:
+    - uses: actions/checkout@v1
+      with:
+        fetch-depth: 1
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v1
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install -r requirements.txt
+    - name: Lint and test with pylint, flake8, doctest, pytest
+      run: |
+        make test_py
diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml
new file mode 100644
index 00000000..0d10cf61
--- /dev/null
+++ b/.github/workflows/shellcheck.yml
@@ -0,0 +1,22 @@
+name: Shellcheck scope.sh
+
+on: 
+  push:
+    paths:
+      - '.github/workflows/shellcheck.yml'
+      - 'ranger/data/scope.sh'
+
+jobs:
+  test_shellcheck:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v1
+      with:
+        fetch-depth: 1
+    - name: Install newer shellcheck (0.7.0 rather than 0.4.6)
+      run: |
+        curl -LO "https://storage.googleapis.com/shellcheck/shellcheck-stable.linux.x86_64.tar.xz"
+        tar xf shellcheck-stable.linux.x86_64.tar.xz
+    - name: Shellcheck scope.sh
+      run: |
+        env PATH=shellcheck-stable:$PATH make test_shellcheck
diff --git a/Makefile b/Makefile
index 87c5ff1b..7e2c62da 100644
--- a/Makefile
+++ b/Makefile
@@ -127,9 +127,9 @@ test: test_py test_shellcheck
 
 man:
 	pod2man --stderr --center='ranger manual' --date='$(NAME)-$(VERSION)' \
-		--release=$(shell date +%x) doc/ranger.pod doc/ranger.1
+		--release=$(shell date -u '+%Y-%m-%d') doc/ranger.pod doc/ranger.1
 	pod2man --stderr --center='rifle manual' --date='$(NAME_RIFLE)-$(VERSION_RIFLE)' \
-		--release=$(shell date +%x) doc/rifle.pod doc/rifle.1
+		--release=$(shell date -u '+%Y-%m-%d') doc/rifle.pod doc/rifle.1
 
 manhtml:
 	pod2html doc/ranger.pod --outfile=doc/ranger.1.html
diff --git a/doc/ranger.1 b/doc/ranger.1
index bccbfa98..ae9543ad 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
+.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -133,7 +133,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RANGER 1"
-.TH RANGER 1 "ranger-1.9.2" "25/07/19" "ranger manual"
+.TH RANGER 1 "ranger-1.9.2" "08/18/2019" "ranger manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -971,6 +971,13 @@ all directories above the current one as well?
 .IP "mouse_enabled [bool] <zm>" 4
 .IX Item "mouse_enabled [bool] <zm>"
 Enable mouse input?
+.IP "nested_ranger_warning [string]" 4
+.IX Item "nested_ranger_warning [string]"
+Warn at startup if \f(CW\*(C`RANGER_LEVEL\*(C'\fR is greater than 0, in other words give a
+warning when you nest ranger in a subshell started by ranger. Allowed values
+are \f(CW\*(C`true\*(C'\fR, \f(CW\*(C`false\*(C'\fR and \f(CW\*(C`error\*(C'\fR. The special value \f(CW\*(C`error\*(C'\fR promotes the
+warning to an error, this is usually shown as red text but will crash ranger
+when run with the \f(CW\*(C`\-\-debug\*(C'\fR flag.
 .IP "one_indexed [bool]" 4
 .IX Item "one_indexed [bool]"
 Start line numbers from 1.  Possible values are:
@@ -1421,7 +1428,7 @@ a row.
 Removes key mappings of the pager. Works like the \f(CW\*(C`unmap\*(C'\fR command.
 .IP "quit" 2
 .IX Item "quit"
-Closes the current tab, if there's only one tab. Otherwise quits if there are no tasks in progress.
+Closes the current tab, if there's more than one tab. Otherwise quits if there are no tasks in progress.
 The current directory will be bookmarked as ' so you can re-enter it by typing `` or '' the next time you
 start ranger.
 .IP "quit!" 2
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 0fd5cc47..4b44fc92 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -985,6 +985,14 @@ all directories above the current one as well?
 
 Enable mouse input?
 
+=item nested_ranger_warning [string]
+
+Warn at startup if C<RANGER_LEVEL> is greater than 0, in other words give a
+warning when you nest ranger in a subshell started by ranger. Allowed values
+are C<true>, C<false> and C<error>. The special value C<error> promotes the
+warning to an error, this is usually shown as red text but will crash ranger
+when run with the C<--debug> flag.
+
 =item one_indexed [bool]
 
 Start line numbers from 1.  Possible values are:
diff --git a/doc/rifle.1 b/doc/rifle.1
index a42734d2..114cc5d0 100644
--- a/doc/rifle.1
+++ b/doc/rifle.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
+.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -54,16 +54,20 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.if !\nF .nr F 0
-.if \nF>0 \{\
-.    de IX
-.    tm Index:\\$1\t\\n%\t"\\$2"
+.nr rF 0
+.if \n(.g .if rF .nr rF 1
+.if (\n(rF:(\n(.g==0)) \{\
+.    if \nF \{\
+.        de IX
+.        tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.    if !\nF==2 \{\
-.        nr % 0
-.        nr F 2
+.        if !\nF==2 \{\
+.            nr % 0
+.            nr F 2
+.        \}
 .    \}
 .\}
+.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -129,7 +133,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RIFLE 1"
-.TH RIFLE 1 "rifle-1.9.2" "2019-04-03" "rifle manual"
+.TH RIFLE 1 "rifle-1.9.2" "08/18/2019" "rifle manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
diff --git a/examples/rc_emacs.conf b/examples/rc_emacs.conf
index 0462282e..e3596ba5 100644
--- a/examples/rc_emacs.conf
+++ b/examples/rc_emacs.conf
@@ -206,6 +206,11 @@ set idle_delay 2000
 # check all directories above the current one as well?
 set metadata_deep_search false
 
+# Warn at startup if RANGER_LEVEL env var is greater than 0, in other words
+# give a warning when you nest ranger in a subshell started by ranger.
+# Special value "error" makes the warning more visible.
+set nested_ranger_warning true
+
 # ===================================================================
 # == Local Options
 # ===================================================================
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 2b1f4940..55dd9cd1 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -572,7 +572,7 @@ class default_linemode(Command):
 class quit(Command):  # pylint: disable=redefined-builtin
     """:quit
 
-    Closes the current tab, if there's only one tab.
+    Closes the current tab, if there's more than one tab.
     Otherwise quits if there are no tasks in progress.
     """
     def _exit_no_work(self):
@@ -591,7 +591,7 @@ class quit(Command):  # pylint: disable=redefined-builtin
 class quit_bang(Command):
     """:quit!
 
-    Closes the current tab, if there's only one tab.
+    Closes the current tab, if there's more than one tab.
     Otherwise force quits immediately.
     """
     name = 'quit!'
@@ -1244,7 +1244,7 @@ class copycmap(copymap):
 
 
 class copytmap(copymap):
-    """:copycmap <keys> <newkeys1> [<newkeys2>...]
+    """:copytmap <keys> <newkeys1> [<newkeys2>...]
 
     Copies a "taskview" keybinding from <keys> to <newkeys>
     """
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index f559290d..00a20def 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -301,6 +301,11 @@ set freeze_files false
 # Print file sizes in bytes instead of the default human-readable format.
 set size_in_bytes false
 
+# Warn at startup if RANGER_LEVEL env var is greater than 0, in other words
+# give a warning when you nest ranger in a subshell started by ranger.
+# Special value "error" makes the warning more visible.
+set nested_ranger_warning true
+
 # ===================================================================
 # == Local Options
 # ===================================================================
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index d15f8b3b..82901ac0 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -58,6 +58,7 @@ ALLOWED_SETTINGS = {
     'max_history_size': (int, type(None)),
     'metadata_deep_search': bool,
     'mouse_enabled': bool,
+    'nested_ranger_warning': str,
     'one_indexed': bool,
     'open_all_images': bool,
     'padding_right': bool,
@@ -105,6 +106,7 @@ ALLOWED_VALUES = {
     'confirm_on_delete': ['multiple', 'always', 'never'],
     'draw_borders': ['none', 'both', 'outline', 'separators'],
     'line_numbers': ['false', 'absolute', 'relative'],
+    'nested_ranger_warning': ['true', 'false', 'error'],
     'one_indexed': [False, True],
     'preview_images_method': ['w3m', 'iterm2', 'terminology',
                               'urxvt', 'urxvt-full', 'kitty',
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 435fcf13..25b01e2c 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -1607,10 +1607,10 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
 
     def delete(self, files=None):
         # XXX: warn when deleting mount points/unseen marked files?
-        self.notify("Deleting!")
         # COMPAT: old command.py use fm.delete() without arguments
         if files is None:
             files = (fobj.path for fobj in self.thistab.get_selection())
+        self.notify("Deleting {}!".format(", ".join(files)))
         files = [os.path.abspath(path) for path in files]
         for path in files:
             # Untag the deleted files.
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 23648677..aefaacbc 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -180,6 +180,16 @@ def main(
             for command in args.cmd:
                 fm.execute_console(command)
 
+        if int(os.environ[level]) > 1:
+            warning = 'Warning:'
+            nested_warning = "You're in a nested ranger instance!"
+            warn_when_nested = fm.settings.nested_ranger_warning.lower()
+            if warn_when_nested == 'true':
+                fm.notify(' '.join((warning, nested_warning)), bad=False)
+            elif warn_when_nested == 'error':
+                fm.notify(' '.join((warning.upper(), nested_warning + '!!')),
+                          bad=True)
+
         if ranger.args.profile:
             import cProfile
             import pstats
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index 306eeed0..eb09b2bf 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -45,7 +45,6 @@ HIGHLIGHT_STYLE=${HIGHLIGHT_STYLE:-pablo}
 HIGHLIGHT_OPTIONS="--replace-tabs=${HIGHLIGHT_TABWIDTH} --style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}"
 PYGMENTIZE_STYLE=${PYGMENTIZE_STYLE:-autumn}
 
-
 handle_extension() {
     case "${FILE_EXTENSION_LOWER}" in
         ## Archive