From 32c33bc80d53dd499c64056f5646869d3d9aed83 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 3 Aug 2017 00:28:59 -0400 Subject: [PATCH 01/11] Adding $VISUAL check --- rtv/__main__.py | 9 ++++++--- rtv/terminal.py | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/rtv/__main__.py b/rtv/__main__.py index c4ef8db..994db2c 100644 --- a/rtv/__main__.py +++ b/rtv/__main__.py @@ -106,13 +106,16 @@ def main(): _logger.info('%s, %s', sys.executable, sys.version) env = [ ('$DISPLAY', os.getenv('DISPLAY')), + ('$TERM', os.getenv('TERM')), ('$XDG_CONFIG_HOME', os.getenv('XDG_CONFIG_HOME')), + ('$RTV_EDITOR', os.getenv('RTV_EDITOR')), + ('$RTV_URLVIEWER', os.getenv('RTV_URLVIEWER')), + ('$RTV_BROWSER', os.getenv('RTV_BROWSER')), ('$BROWSER', os.getenv('BROWSER')), ('$PAGER', os.getenv('PAGER')), - ('$RTV_EDITOR', os.getenv('RTV_EDITOR')), - ('$RTV_URLVIEWER', os.getenv('RTV_URLVIEWER'))] + ('$VISUAL', os.getenv('VISUAL')), + ('$EDITOR', os.getenv('EDITOR'))] _logger.info('Environment: %s', env) - else: # Add an empty handler so the logger doesn't complain logging.root.addHandler(logging.NullHandler()) diff --git a/rtv/terminal.py b/rtv/terminal.py index 3ed9e64..eadec67 100644 --- a/rtv/terminal.py +++ b/rtv/terminal.py @@ -569,7 +569,10 @@ class Terminal(object): fp.write(data) _logger.info('File created: %s', filepath) - editor = os.getenv('RTV_EDITOR') or os.getenv('EDITOR') or 'nano' + editor = (os.getenv('RTV_EDITOR') or + os.getenv('VISUAL') or + os.getenv('EDITOR') or + 'nano') command = shlex.split(editor) + [filepath] try: with self.suspend(): From a76ba5ce936a6016369756c4cf28a53ad022b7e2 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 3 Aug 2017 00:30:22 -0400 Subject: [PATCH 02/11] Updating readme --- README.rst | 51 +++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/README.rst b/README.rst index 7cb2ad4..32e0eca 100644 --- a/README.rst +++ b/README.rst @@ -100,9 +100,9 @@ See `CONTROLS `_ Settings ======== -------------- -Configuration -------------- +------------------ +Configuration File +------------------ Configuration files are stored in the ``{HOME}/.config/rtv/`` directory @@ -112,9 +112,9 @@ See `rtv.cfg `_ to configure how RTV will open different types of links @@ -134,26 +134,33 @@ This template contains examples for common MIME types that work with popular red Once you've setup your mailcap file, enable it by launching rtv with the ``rtv --enable-media`` flag (or set it in your **rtv.cfg**) ------------ -Environment ------------ +--------------------- +Environment Variables +--------------------- -RTV will respect the following environment variables when accessing external programs +The default programs that RTV interacts with can be configured through environment variables -``$BROWSER`` - Submission links will be opened inside of your web browser. On most systems, the default web browser will pop up in a new window. If you prefer the complete terminal experience, try using a console-based web browser (`w3m `_, `lynx `_, and `elinks `_ are all good choices). -``$PAGER`` - Extra long comments and submissions can be opened using the system's pager. ``$RTV_EDITOR`` - Composing posts and replying to comments is done using your preferred text editor. If not specified, the default system ``$EDITOR`` (or *nano*) will be used. -``$RTV_URLVIEWER`` - A url viewer is a tool that can be used to extract hyperlinks from inside of blocks of text. `urlview `_ and `urlscan `_ are known to be compatible with rtv. These applications don't come pre-installed, but are available through most systems' package managers. + | A program used to compose text submissions and comments. + | If not specified, will fallback to ``$VISUAL`` and ``$EDITOR`` in that order. + | *Examples: vim, emacs, gedit* ----- -Copy ----- -RTV supports copying submission links to the OS clipboard. For macOS it is supported out of the box, -in Linux systems RTV will need `xsel `_ or `xclip `_ commands to be installed in the system. +``$RTV_BROWSER`` + | A program used to open links to external websites. + | If not specified, will fallback to ``$BROWSER``, or attempt to intelligently choose a browser supported by your system. + | *Examples: firefox, google-chrome, w3m, lynx, elinks* + +``$RTV_URLVIEWER`` + | A tool used to extract hyperlinks from from text. + | If not specified, will fallback to **urlview** if it is installed. + | *Examples: `urlview `_, `urlscan `_* + +------------------------ +Copying to the Clipboard +------------------------ +RTV supports copying submission links to the OS clipboard. +On macOS this is supported out of the box. +On Linux systems you will need to install either `xsel `_ or `xclip `_. === FAQ From ffd887c87f5939bf91e0966db4731334ca01ea74 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 3 Aug 2017 00:32:03 -0400 Subject: [PATCH 03/11] Update README.rst --- README.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index 32e0eca..a223747 100644 --- a/README.rst +++ b/README.rst @@ -141,19 +141,19 @@ Environment Variables The default programs that RTV interacts with can be configured through environment variables ``$RTV_EDITOR`` - | A program used to compose text submissions and comments. - | If not specified, will fallback to ``$VISUAL`` and ``$EDITOR`` in that order. - | *Examples: vim, emacs, gedit* + | A program used to compose text submissions and comments + | *If not specified, will fallback to ``$VISUAL`` and ``$EDITOR`` in that order* + | Examples: **vim**, **emacs**, **gedit** ``$RTV_BROWSER`` - | A program used to open links to external websites. - | If not specified, will fallback to ``$BROWSER``, or attempt to intelligently choose a browser supported by your system. - | *Examples: firefox, google-chrome, w3m, lynx, elinks* + | A program used to open links to external websites + | *If not specified, will fallback to ``$BROWSER``, or attempt to intelligently choose a browser supported by your system* + | Examples: **firefox**, **google-chrome**, **w3m**, **lynx**, **elinks** ``$RTV_URLVIEWER`` - | A tool used to extract hyperlinks from from text. - | If not specified, will fallback to **urlview** if it is installed. - | *Examples: `urlview `_, `urlscan `_* + | A tool used to extract hyperlinks from from text + | *If not specified, will fallback to **urlview** if it is installed* + | Examples: **`urlview `_**, **`urlscan `_** ------------------------ Copying to the Clipboard From 81ffabe93a4a5d039f509866fe6bebe9930e528a Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 3 Aug 2017 00:33:45 -0400 Subject: [PATCH 04/11] Update README.rst --- README.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index a223747..065f803 100644 --- a/README.rst +++ b/README.rst @@ -142,18 +142,18 @@ The default programs that RTV interacts with can be configured through environme ``$RTV_EDITOR`` | A program used to compose text submissions and comments + | E.g. **vim**, **emacs**, **gedit** | *If not specified, will fallback to ``$VISUAL`` and ``$EDITOR`` in that order* - | Examples: **vim**, **emacs**, **gedit** ``$RTV_BROWSER`` | A program used to open links to external websites + | E.g. **firefox**, **google-chrome**, **w3m**, **lynx**, **elinks** | *If not specified, will fallback to ``$BROWSER``, or attempt to intelligently choose a browser supported by your system* - | Examples: **firefox**, **google-chrome**, **w3m**, **lynx**, **elinks** ``$RTV_URLVIEWER`` | A tool used to extract hyperlinks from from text - | *If not specified, will fallback to **urlview** if it is installed* - | Examples: **`urlview `_**, **`urlscan `_** + | E.g. `urlview `_, `urlscan `_ + | *If not specified, will fallback to urlview if it is installed* ------------------------ Copying to the Clipboard From b8a13370b5dd6f0873ef7ac7d00562525bf81b17 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 3 Aug 2017 00:34:20 -0400 Subject: [PATCH 05/11] Update README.rst --- README.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.rst b/README.rst index 065f803..82d79a5 100644 --- a/README.rst +++ b/README.rst @@ -143,16 +143,19 @@ The default programs that RTV interacts with can be configured through environme ``$RTV_EDITOR`` | A program used to compose text submissions and comments | E.g. **vim**, **emacs**, **gedit** + | | *If not specified, will fallback to ``$VISUAL`` and ``$EDITOR`` in that order* ``$RTV_BROWSER`` | A program used to open links to external websites | E.g. **firefox**, **google-chrome**, **w3m**, **lynx**, **elinks** + | | *If not specified, will fallback to ``$BROWSER``, or attempt to intelligently choose a browser supported by your system* ``$RTV_URLVIEWER`` | A tool used to extract hyperlinks from from text | E.g. `urlview `_, `urlscan `_ + | | *If not specified, will fallback to urlview if it is installed* ------------------------ From 9b534cf427eded27301c75c58636256e3a816089 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 3 Aug 2017 00:35:30 -0400 Subject: [PATCH 06/11] Update README.rst --- README.rst | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index 82d79a5..8aca0b6 100644 --- a/README.rst +++ b/README.rst @@ -141,21 +141,15 @@ Environment Variables The default programs that RTV interacts with can be configured through environment variables ``$RTV_EDITOR`` - | A program used to compose text submissions and comments - | E.g. **vim**, **emacs**, **gedit** - | + | A program used to compose text submissions and comments, e.g. **vim**, **emacs**, **gedit** | *If not specified, will fallback to ``$VISUAL`` and ``$EDITOR`` in that order* ``$RTV_BROWSER`` - | A program used to open links to external websites - | E.g. **firefox**, **google-chrome**, **w3m**, **lynx**, **elinks** - | + | A program used to open links to external websites, e.g. **firefox**, **google-chrome**, **w3m**, **lynx**, **elinks** | *If not specified, will fallback to ``$BROWSER``, or attempt to intelligently choose a browser supported by your system* ``$RTV_URLVIEWER`` - | A tool used to extract hyperlinks from from text - | E.g. `urlview `_, `urlscan `_ - | + | A tool used to extract hyperlinks from from text, e.g. `urlview `_, `urlscan `_ | *If not specified, will fallback to urlview if it is installed* ------------------------ From 6485c4732783d089773a6d32ef4998177fb0c641 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 3 Aug 2017 00:35:53 -0400 Subject: [PATCH 07/11] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 8aca0b6..0a78216 100644 --- a/README.rst +++ b/README.rst @@ -146,7 +146,7 @@ The default programs that RTV interacts with can be configured through environme ``$RTV_BROWSER`` | A program used to open links to external websites, e.g. **firefox**, **google-chrome**, **w3m**, **lynx**, **elinks** - | *If not specified, will fallback to ``$BROWSER``, or attempt to intelligently choose a browser supported by your system* + | *If not specified, will fallback to ``$BROWSER``, or try to intelligently choose a browser supported by your system* ``$RTV_URLVIEWER`` | A tool used to extract hyperlinks from from text, e.g. `urlview `_, `urlscan `_ From d44d5aa82c802568cdcb93dca7f28a53cb857225 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 3 Aug 2017 00:36:22 -0400 Subject: [PATCH 08/11] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 0a78216..148d33d 100644 --- a/README.rst +++ b/README.rst @@ -149,7 +149,7 @@ The default programs that RTV interacts with can be configured through environme | *If not specified, will fallback to ``$BROWSER``, or try to intelligently choose a browser supported by your system* ``$RTV_URLVIEWER`` - | A tool used to extract hyperlinks from from text, e.g. `urlview `_, `urlscan `_ + | A tool used to extract hyperlinks from blocks of text, e.g. `urlview `_, `urlscan `_ | *If not specified, will fallback to urlview if it is installed* ------------------------ From 4ea6b883ab487d7591153757135eefd0c8a8fcef Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 3 Aug 2017 00:36:50 -0400 Subject: [PATCH 09/11] Update README.rst --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 148d33d..3afec2e 100644 --- a/README.rst +++ b/README.rst @@ -142,15 +142,15 @@ The default programs that RTV interacts with can be configured through environme ``$RTV_EDITOR`` | A program used to compose text submissions and comments, e.g. **vim**, **emacs**, **gedit** - | *If not specified, will fallback to ``$VISUAL`` and ``$EDITOR`` in that order* + | *If not specified, will fallback to ``$VISUAL`` and ``$EDITOR`` in that order.* ``$RTV_BROWSER`` | A program used to open links to external websites, e.g. **firefox**, **google-chrome**, **w3m**, **lynx**, **elinks** - | *If not specified, will fallback to ``$BROWSER``, or try to intelligently choose a browser supported by your system* + | *If not specified, will fallback to ``$BROWSER``, or try to intelligently choose a browser supported by your system.* ``$RTV_URLVIEWER`` | A tool used to extract hyperlinks from blocks of text, e.g. `urlview `_, `urlscan `_ - | *If not specified, will fallback to urlview if it is installed* + | *If not specified, will fallback to urlview if it is installed.* ------------------------ Copying to the Clipboard From 95ddf51b622fcc43199b9723616ae26399cbe150 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 3 Aug 2017 00:52:24 -0400 Subject: [PATCH 10/11] Fix CI --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 1f0b1ef..5a408df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: python +dist: precise python: - 2.7 - 3.3 From 6d364fb0700db05c9d434cbbe81aa5d8fd3d047e Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 3 Aug 2017 00:56:32 -0400 Subject: [PATCH 11/11] Updating gitignore to track some hidden files --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index d061f28..8caaf99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ .* +!.travis.yml +!.pylintrc +!.gitignore +!.gitattributes +!.coveragerc *~ *.pyc build