Skip to content

Commit

Permalink
Merge pull request #650 from TDaglis/master
Browse files Browse the repository at this point in the history
Recognise cygwin platform and open urls accordingly
  • Loading branch information
untitaker authored Sep 5, 2016
2 parents 7a48f3e + 97b6cbd commit c523050
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions click/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

PY2 = sys.version_info[0] == 2
WIN = sys.platform.startswith('win')
CYGWIN = sys.platform.startswith('cygwin')
DEFAULT_COLUMNS = 80


Expand Down
11 changes: 10 additions & 1 deletion click/_termui_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
import time
import math
from ._compat import _default_text_stdout, range_type, PY2, isatty, \
open_stream, strip_ansi, term_len, get_best_encoding, WIN, int_types
open_stream, strip_ansi, term_len, get_best_encoding, WIN, int_types, \
CYGWIN
from .utils import echo
from .exceptions import ClickException

Expand Down Expand Up @@ -478,6 +479,14 @@ def _unquote_file(url):
args = 'start %s "" "%s"' % (
wait and '/WAIT' or '', url.replace('"', ''))
return os.system(args)
elif CYGWIN:
if locate:
url = _unquote_file(url)
args = 'cygstart "%s"' % (os.path.dirname(url).replace('"', ''))
else:
args = 'cygstart %s "%s"' % (
wait and '-w' or '', url.replace('"', ''))
return os.system(args)

try:
if locate:
Expand Down

0 comments on commit c523050

Please sign in to comment.