Fixed an issue with get_os_args and export it.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Armin Ronacher · committed by Armin Ronacher · parent c1d213a · Browse files · 2 files·+15 added−6 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+15 added−6 removed
- other:+15 added−6 removed
Provenance
- Commit
5560183- Tree
8fe4740- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
c1d213a
2 files changed+15 added−6 removed
modified:click/__init__.py+2 added-2 removed
30 unmodified lines31 STRING, INT, FLOAT, BOOL, UUID, UNPROCESSED32 33 # Utilities34 from .utils import echo, get_binary_stream, get_text_stream, open_file, \35- format_filename, get_app_dir35+ format_filename, get_app_dir, get_os_args36 37 # Terminal functions38 from .termui import prompt, confirm, get_terminal_size, echo_via_pager, \39 progressbar, clear, style, unstyle, secho, edit, launch, getchar, \28 unmodified lines68 'INT', 'FLOAT', 'BOOL', 'UUID', 'UNPROCESSED',69 70 # Utilities71 'echo', 'get_binary_stream', 'get_text_stream', 'open_file',72- 'format_filename', 'get_app_dir',72+ 'format_filename', 'get_app_dir', 'get_os_args',73 74 # Terminal functions75 'prompt', 'confirm', 'get_terminal_size', 'echo_via_pager',76 'progressbar', 'clear', 'style', 'unstyle', 'secho', 'edit', 'launch',20 unmodified linesmodified:click/utils.py+13 added-4 removed
234 unmodified lines235 236 Primarily it means that you can print binary data as well as Unicode237 data on both 2.x and 3.x to the given file in the most appropriate way238 possible. This is a very carefree function as in that it will try its239- best to not fail.239+ best to not fail. As of Click 6.0 this includes support for unicode240+ output on the Windows console.241 242 In addition to that, if `colorama`_ is installed, the echo function will243 also support clever handling of ANSI codes. Essentially it will then244 do the following:3 unmodified lines248 terminal.249 250 .. _colorama: http://pypi.python.org/pypi/colorama251 252+ .. versionchanged:: 6.0253+ As of Click 6.0 the echo function will properly support unicode254+ output on the windows console. Not that click does not modify255+ the interpreter in any way which means that `sys.stdout` or the256+ print statement or function will still not provide unicode support.257+258 .. versionchanged:: 2.0259 Starting with version 2.0 of Click, the echo function will work260 with colorama if it's installed.261 138 unmodified lines400 However if you are on Windows and running Python 2 the return value401 will actually be a list of unicode strings instead because the402 default behavior on that platform otherwise will not be able to403 carry all possible values that sys.argv can have.404+405+ .. versionadded:: 6.0406 """398- if not PY2 or os.name != 'nt':399- return sys.argv[1:]400- return _get_windows_argv()407+ if PY2 and WIN:408+ return _get_windows_argv()409+ return sys.argv[1:]410 411 412 def format_filename(filename, shorten=False):413 """Formats a filename for user display. The main purpose of this64 unmodified lines