Skip to content

Commit

Permalink
config -e: Parse arguments in $EDITOR (fix #1200)
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Jan 5, 2015
1 parent 1f3fc60 commit e13e7ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion beets/ui/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import codecs
import platform
import re
import shlex

import beets
from beets import ui
Expand Down Expand Up @@ -1503,7 +1504,12 @@ def config_edit():

if 'EDITOR' in os.environ:
editor = os.environ['EDITOR']
args = [editor, editor, path]
try:
editor = shlex.split(editor)
except ValueError: # Malformed shell tokens.
editor = [editor]
args = editor + [path]
args.insert(1, args[0])
elif platform.system() == 'Darwin':
args = ['open', 'open', '-n', path]
elif platform.system() == 'Windows':
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ Fixed:
twice in the artist string. Thanks to Marc Addeo. :bug:`1179` :bug:`1181`
* :doc:`/plugins/lastgenre`: Match songs more robustly when they contain
dashes. Thanks to :user:`djl`. :bug:`1156`
* The :ref:`config-cmd` command can now use ``$EDITOR`` variables with
arguments.

.. _API changes: http://developer.echonest.com/forums/thread/3650
.. _Plex: https://plex.tv/
Expand Down

0 comments on commit e13e7ed

Please sign in to comment.