Skip to content
Myr

Merge with upstream changes and use resilient_parsing flag to ignore default values.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nicholas Wiles · committed by Nicholas Wiles · parents b61ec64, 084da90 · Browse files · 35 files+530 added−1052 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

35 files+530 added−1052 removed

  • tests:+112 added−0 removed
  • other:+418 added−1052 removed

35 files+530 added−1052 removed

modified:click/_bashcomplete.py+4 added-6 removed
70 unmodified lines
71 :param prog_name: the program that is running72 :param args: full list of args73 :return: the final context/command parsed74 """75 ctx = cli.make_context(prog_name, args, resilient_parsing=True, ignore_default_values=True)75 ctx = cli.make_context(prog_name, args, resilient_parsing=True)76 args = ctx.protected_args + ctx.args77 while args:78 if isinstance(ctx.command, MultiCommand):79 if not ctx.command.chain:80 cmd_name, cmd, args = ctx.command.resolve_command(ctx, args)81 if cmd is None:82 return ctx83 ctx = cmd.make_context(cmd_name, args, parent=ctx,84 resilient_parsing=True,85 ignore_default_values=True)84 resilient_parsing=True)85 args = ctx.protected_args + ctx.args86 else:87 # Walk chained subcommand contexts saving the last one.88 while args:
2 unmodified lines
91 return ctx92 sub_ctx = cmd.make_context(cmd_name, args, parent=ctx,93 allow_extra_args=True,94 allow_interspersed_args=False,96 resilient_parsing=True,97 ignore_default_values=True)95 resilient_parsing=True)96 args = sub_ctx.args97 ctx = sub_ctx98 args = sub_ctx.protected_args + sub_ctx.args99 else:
159 unmodified lines
259 echo(get_completion_script(prog_name, complete_var, shell))260 return True261 elif complete_instr == 'complete' or complete_instr == 'complete_zsh':262 return do_complete(cli, prog_name, complete_instr == 'complete_zsh')265 return False263 return False
modified:click/_winconsole.py+1 added-1 removed
13 unmodified lines
14import zlib15import time16import ctypes17import msvcrt18from click._compat import _NonClosingTextIOWrapper, text_type, PY218from ._compat import _NonClosingTextIOWrapper, text_type, PY219from ctypes import byref, POINTER, c_int, c_char, c_char_p, \20 c_void_p, py_object, c_ssize_t, c_ulong, windll, WINFUNCTYPE21try:22 from ctypes import pythonapi
251 unmodified lines
modified:click/core.py+32 added-12 removed
7 unmodified lines
89from .types import convert_type, IntRange, BOOL10from .utils import make_str, make_default_short_help, echo, get_os_args11from .exceptions import ClickException, UsageError, BadParameter, Abort, \12 MissingParameter12 MissingParameter, Exit13from .termui import prompt, confirm, style14from .formatting import HelpFormatter, join_options15from .parser import OptionParser, split_opt16from .globals import push_context, pop_context
164 unmodified lines
181 default. In addition to that, formatters might182 add some safety mapping on the right.183 :param resilient_parsing: if this flag is enabled then Click will184 parse without any interactivity or callback185 invocation. This is useful for implementing185 invocation. Default values will also be186 ignored. This is useful for implementing187 things such as completion support.188 :param allow_extra_args: if this is set to `True` then extra arguments189 at the end will not raise an error and will be190 kept on the context. The default is to inherit
23 unmodified lines
214 terminal_width=None, max_content_width=None,215 resilient_parsing=False, allow_extra_args=None,216 allow_interspersed_args=None,217 ignore_unknown_options=None, help_option_names=None,217 token_normalize_func=None, color=None, ignore_default_values=False):218 token_normalize_func=None, color=None):219 #: the parent context or `None` if none exists.220 self.parent = parent221 #: the :class:`Command` for this context.222 self.command = command
89 unmodified lines
312 #: options, choices, commands etc.313 self.token_normalize_func = token_normalize_func314315 #: Indicates if resilient parsing is enabled. In that case Click315 #: will do its best to not cause any failures.316 #: will do its best to not cause any failures and default values317 #: will be ignored. Useful for completion.318 self.resilient_parsing = resilient_parsing319318 #: Indicates that default values should be ignored.319 #: Useful for completion.320321 #: .. versionadded:: 7.0322 self.ignore_default_values = ignore_default_values323320 # If there is no envvar prefix yet, but the parent has one and321 # the command on this level has a name, we can expand the envvar322 # prefix automatically.323 if auto_envvar_prefix is None:
175 unmodified lines
499 raise Abort()500501 def exit(self, code=0):502 """Exits the application with a given exit code."""507 sys.exit(code)503 raise Exit(code)504505 def get_usage(self):506 """Helper method to get formatted usage string for the current507 context and command.
207 unmodified lines
715 with self.make_context(prog_name, args, **extra) as ctx:716 rv = self.invoke(ctx)717 if not standalone_mode:718 return rv719 # it's not safe to `ctx.exit(rv)` here!720 # note that `rv` may actually contain data like "1" which721 # has obvious effects722 # more subtle case: `rv=[None, None]` can come out of723 # chained commands which all returned `None` -- so it's not724 # even always obvious that `rv` indicates success/failure725 # by its truthiness/falsiness726 ctx.exit()727 except (EOFError, KeyboardInterrupt):728 echo(file=sys.stderr)729 raise Abort()
6 unmodified lines
736 if e.errno == errno.EPIPE:737 sys.exit(1)738 else:739 raise740 except Exit as e:741 if standalone_mode:742 sys.exit(e.exit_code)743 else:744 # in non-standalone mode, return the exit code745 # note that this is only reached if `self.invoke` above raises746 # an Exit explicitly -- thus bypassing the check there which747 # would return its result748 # the results of non-standalone execution may therefore be749 # somewhat ambiguous: if there are codepaths which lead to750 # `ctx.exit(1)` and to `return 1`, the caller won't be able to751 # tell the difference between the two752 return e.exit_code753 except Abort:754 if not standalone_mode:755 raise756 echo('Aborted!', file=sys.stderr)
42 unmodified lines
799 #: the list of parameters for this command in the order they800 #: should show up in the help page and execute. Eager parameters801 #: will automatically be handled before non eager ones.802 self.params = params or []803 # if a form feed (page break) is found in the help text, truncate help804 # text to the content preceding the first form feed805 if help and '\f' in help:806 help = help.split('\f', 1)[0]807 self.help = help808 self.epilog = epilog809 self.options_metavar = options_metavar810 self.short_help = short_help
623 unmodified lines
14341435 def full_process_value(self, ctx, value):1436 value = self.process_value(ctx, value)14371418 if value is None and not ctx.ignore_default_values:1438 if value is None and not ctx.resilient_parsing:1439 value = self.get_default(ctx)14401441 if self.required and self.value_is_missing(value):1442 raise MissingParameter(ctx=ctx, param=self)
414 unmodified lines
modified:click/decorators.py+1 added-1 removed
59 unmodified lines
60 if obj is None:61 raise RuntimeError('Managed to invoke callback without a '62 'context object of type %r existing'63 % object_type.__name__)64 return ctx.invoke(f, obj, *args[1:], **kwargs)64 return ctx.invoke(f, obj, *args, **kwargs)65 return update_wrapper(new_func, f)66 return decorator6768
243 unmodified lines
modified:click/exceptions.py+10 added
221 unmodified lines
222223224class Abort(RuntimeError):225 """An internal signalling exception that signals Click to abort."""226227228class Exit(RuntimeError):229 """An exception that indicates that the application should exit with some230 status code.231232 :param code: the status code to exit with.233 """234 def __init__(self, code=0):235 self.exit_code = code
modified:click/testing.py+1 added-1 removed
81 unmodified lines
82 #: The standard error as bytes, or False(y) if not available83 self.stderr_bytes = stderr_bytes84 #: The exit code as integer.85 self.exit_code = exit_code86 #: The exception that happend if one did.86 #: The exception that happened if one did.87 self.exception = exception88 #: The traceback89 self.exc_info = exc_info90
284 unmodified lines
modified:click/types.py+13 added-9 removed
124 unmodified lines
125 return 'STRING'126127128class Choice(ParamType):129 """The choice type allows a value to be checked against a fixed set of130 supported values. All of these values have to be strings.129 """The choice type allows a value to be checked against a fixed set130 of supported values. All of these values have to be strings.131132 You should only pass *choices* as list or tuple. Other iterables (like133 generators) may lead to surprising results.132 You should only pass a list or tuple of choices. Other iterables133 (like generators) may lead to surprising results.134135 See :ref:`choice-opts` for an example.136137 :param case_sensitive: Set to false to make choices case insensitive.138 Defaults to true.137 :param case_sensitive: Set to false to make choices case138 insensitive. Defaults to true.139 """140141 name = 'choice'142143 def __init__(self, choices, case_sensitive=True):144 self.choices = choices
186 unmodified lines
331 By default, the file is opened for reading text data, but it can also be332 opened in binary mode or for writing. The encoding parameter can be used333 to force a specific encoding.334334 The `lazy` flag controls if the file should be opened immediately or335 upon first IO. The default is to be non lazy for standard input and336 output streams as well as files opened for reading, lazy otherwise.335 The `lazy` flag controls if the file should be opened immediately or upon336 first IO. The default is to be non-lazy for standard input and output337 streams as well as files opened for reading, `lazy` otherwise. When opening a338 file lazily for reading, it is still opened temporarily for validation, but339 will not be held open until first IO. lazy is mainly useful when opening340 for writing to avoid creating the file until it is needed.341342 Starting with Click 2.0, files can also be opened atomically in which343 case all writes go into a separate file in the same folder and upon344 completion the file will be moved over to the original location. This
270 unmodified lines
added:docs/_static/click-icon.pngbinary

A binary file, added.

added:docs/_static/click-logo-sidebar.pngbinary

A binary file, added.

added:docs/_static/click-logo.pngbinary

A binary file, added.

deleted:docs/_static/click-small.pngbinary

A binary file, deleted.

deleted:docs/_static/click-small@2x.pngbinary

A binary file, deleted.

deleted:docs/_static/click.pngbinary

A binary file, deleted.

deleted:docs/_static/click@2x.pngbinary

A binary file, deleted.

deleted:docs/_templates/sidebarintro.html-13 removed
deleted:docs/_templates/sidebarlogo.html-3 removed
1<p class="logo"><a href="{{ pathto(master_doc) }}">2 <img class="logo" src="{{ pathto('_static/click-small@2x.png', 1) }}" width="120" height="50" alt="Logo">3</a></p>
modified:docs/changelog.rst+1 added-1 removed
1.. currentmodule:: click23.. include:: ../CHANGES3.. include:: ../CHANGES.rst
deleted:docs/clickdoctools.py-282 removed
1import os2import sys3import click4import shutil5import tempfile6import contextlib7import subprocess89try:10 from StringIO import StringIO11except ImportError:12 from io import StringIO1314from docutils import nodes15from docutils.statemachine import ViewList1617from sphinx.domains import Domain18from docutils.parsers.rst import Directive1920PY2 = sys.version_info[0] == 22122if PY2:23 text_type = unicode24else:25 text_type = str26 2728class EchoingStdin(object):2930 def __init__(self, input, output):31 self._input = input32 self._output = output3334 def __getattr__(self, x):35 return getattr(self._input, x)3637 def _echo(self, rv):38 mark = False39 if rv.endswith('\xff'):40 rv = rv[:-1]41 mark = True42 self._output.write(rv)43 if mark:44 self._output.write('^D\n')45 return rv4647 def read(self, n=-1):48 return self._echo(self._input.read(n))4950 def readline(self, n=-1):51 return self._echo(self._input.readline(n))5253 def readlines(self):54 return [self._echo(x) for x in self._input.readlines()]5556 def __iter__(self):57 return iter(self._echo(x) for x in self._input)585960@contextlib.contextmanager61def fake_modules():62 old_call = subprocess.call63 def dummy_call(*args, **kwargs):64 with tempfile.TemporaryFile('wb+') as f:65 kwargs['stdout'] = f66 kwargs['stderr'] = f67 rv = subprocess.Popen(*args, **kwargs).wait()68 f.seek(0)69 click.echo(f.read().decode('utf-8', 'replace').rstrip())70 return rv71 subprocess.call = dummy_call72 try:73 yield74 finally:75 subprocess.call = old_call767778@contextlib.contextmanager79def isolation(input=None, env=None):80 if isinstance(input, text_type):81 input = input.encode('utf-8')82 input = StringIO(input or '')83 output = StringIO()84 sys.stdin = EchoingStdin(input, output)85 sys.stdin.encoding = 'utf-8'8687 def visible_input(prompt=None):88 sys.stdout.write(prompt or '')89 val = input.readline().rstrip('\r\n')90 sys.stdout.write(val + '\n')91 sys.stdout.flush()92 return val9394 def hidden_input(prompt=None):95 sys.stdout.write((prompt or '') + '\n')96 sys.stdout.flush()97 return input.readline().rstrip('\r\n')9899 sys.stdout = output100 sys.stderr = output101 old_visible_prompt_func = click.termui.visible_prompt_func102 old_hidden_prompt_func = click.termui.hidden_prompt_func103 click.termui.visible_prompt_func = visible_input104 click.termui.hidden_prompt_func = hidden_input105106 old_env = {}107 try:108 if env:109 for key, value in env.iteritems():110 old_env[key] = os.environ.get(value)111 os.environ[key] = value112 yield output113 finally:114 for key, value in old_env.iteritems():115 if value is None:116 try:117 del os.environ[key]118 except Exception:119 pass120 else:121 os.environ[key] = value122 sys.stdout = sys.__stdout__123 sys.stderr = sys.__stderr__124 click.termui.visible_prompt_func = old_visible_prompt_func125 click.termui.hidden_prompt_func = old_hidden_prompt_func126127128@contextlib.contextmanager129def isolated_filesystem():130 cwd = os.getcwd()131 t = tempfile.mkdtemp()132 os.chdir(t)133 try:134 yield135 finally:136 os.chdir(cwd)137 try:138 shutil.rmtree(t)139 except (OSError, IOError):140 pass141142143class ExampleRunner(object):144145 def __init__(self):146 self.namespace = {147 'click': click,148 '__file__': 'dummy.py',149 }150151 def declare(self, source):152 with fake_modules():153 code = compile(source, '<docs>', 'exec')154 eval(code, self.namespace)155156 def run(self, source):157 code = compile(source, '<docs>', 'exec')158 buffer = []159160 def invoke(cmd, args=None, prog_name=None,161 input=None, terminate_input=False, env=None,162 **extra):163 if env:164 for key, value in sorted(env.items()):165 if ' ' in value:166 value = '"%s"' % value167 buffer.append('$ export %s=%s' % (key, value))168 args = args or []169 if prog_name is None:170 prog_name = cmd.name.replace('_', '-')171 buffer.append(('$ %s %s' % (172 prog_name,173 ' '.join(('"%s"' % x) if ' ' in x else x for x in args)174 )).rstrip())175 if isinstance(input, (tuple, list)):176 input = '\n'.join(input) + '\n'177 if terminate_input:178 input += '\xff'179 with isolation(input=input, env=env) as output:180 try:181 cmd.main(args=args, prog_name=prog_name.split()[-1],182 **extra)183 except SystemExit:184 pass185 buffer.extend(output.getvalue().splitlines())186187 def println(text=''):188 buffer.append(text)189190 eval(code, self.namespace, {191 'invoke': invoke,192 'println': println,193 'isolated_filesystem': isolated_filesystem,194 })195 return buffer196197 def close(self):198 pass199200201def parse_rst(state, content_offset, doc):202 node = nodes.section()203 # hack around title style bookkeeping204 surrounding_title_styles = state.memo.title_styles205 surrounding_section_level = state.memo.section_level206 state.memo.title_styles = []207 state.memo.section_level = 0208 state.nested_parse(doc, content_offset, node, match_titles=1)209 state.memo.title_styles = surrounding_title_styles210 state.memo.section_level = surrounding_section_level211 return node.children212213214def get_example_runner(document):215 runner = getattr(document, 'click_example_runner', None)216 if runner is None:217 runner = document.click_example_runner = ExampleRunner()218 return runner219220221class ExampleDirective(Directive):222 has_content = True223 required_arguments = 0224 optional_arguments = 0225 final_argument_whitespace = False226227 def run(self):228 doc = ViewList()229 runner = get_example_runner(self.state.document)230 try:231 runner.declare('\n'.join(self.content))232 except:233 runner.close()234 raise235 doc.append('.. sourcecode:: python', '')236 doc.append('', '')237 for line in self.content:238 doc.append(' ' + line, '')239 return parse_rst(self.state, self.content_offset, doc)240241242class RunExampleDirective(Directive):243 has_content = True244 required_arguments = 0245 optional_arguments = 0246 final_argument_whitespace = False247248 def run(self):249 doc = ViewList()250 runner = get_example_runner(self.state.document)251 try:252 rv = runner.run('\n'.join(self.content))253 except:254 runner.close()255 raise256 doc.append('.. sourcecode:: text', '')257 doc.append('', '')258 for line in rv:259 doc.append(' ' + line, '')260 return parse_rst(self.state, self.content_offset, doc)261262263class ClickDomain(Domain):264 name = 'click'265 label = 'Click'266 directives = {267 'example': ExampleDirective,268 'run': RunExampleDirective,269 }270271272def delete_example_runner_state(app, doctree):273 runner = getattr(doctree, 'click_example_runner', None)274 if runner is not None:275 runner.close()276 del doctree.click_example_runner277278279def setup(app):280 app.add_domain(ClickDomain)281282 app.connect('doctree-read', delete_example_runner_state)
modified:docs/commands.rst+4 added
85 unmodified lines
86 @click.group()87 @click.option('--debug/--no-debug', default=False)88 @click.pass_context89 def cli(ctx, debug):90 # ensure that ctx.obj exists and is a dict (in case `cli()` is called91 # by means other than the `if` block below92 ctx.ensure_object(dict)9394 ctx.obj['DEBUG'] = debug9596 @cli.command()97 @click.pass_context
465 unmodified lines
modified:docs/complex.rst+3 added-2 removed
185 unmodified lines
186The above example only works if there was an outer command that created a187``Repo`` object and stored it in the context. For some more advanced use188cases, this might become a problem. The default behavior of189:func:`make_pass_decorator` is to call :meth:`Context.find_object`190which will find the object. If it can't find the object, it will raise an191error. The alternative behavior is to use :meth:`Context.ensure_object`190which will find the object. If it can't find the object,191:meth:`make_pass_decorator` will raise an error.192The alternative behavior is to use :meth:`Context.ensure_object`193which will find the object, and if it cannot find it, will create one and194store it in the innermost context. This behavior can also be enabled for195:func:`make_pass_decorator` by passing ``ensure=True``:196
24 unmodified lines
modified:docs/conf.py+33 added-206 removed
1# -*- coding: utf-8 -*-2#3# click documentation build configuration file, created by4# sphinx-quickstart on Mon Apr 26 19:53:01 2010.5#6# This file is execfile()d with the current directory set to its containing dir.7#8# Note that not all possible configuration values are present in this9# autogenerated file.10#11# All configuration values have a default; values that are commented out12# serve to show the default.1from pallets_sphinx_themes import ProjectLink, get_version214import sys, os15import datetime3# Project --------------------------------------------------------------417# If extensions (or modules to document with autodoc) are in another directory,18# add these directories to sys.path here. If the directory is relative to the19# documentation root, use os.path.abspath to make it absolute, like shown here.20sys.path.append(os.path.abspath('..'))21sys.path.append(os.path.abspath('.'))5project = "Click"6copyright = "2014 Pallets Team"7author = "Pallets Team"8release, version = get_version("Click", version_length=1)923# -- General configuration -----------------------------------------------------10# General --------------------------------------------------------------1125# If your documentation needs a minimal Sphinx version, state it here.26#needs_sphinx = '1.0'12master_doc = "index"13extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx", "pallets_sphinx_themes"]14intersphinx_mapping = {"python": ("https://docs.python.org/3/", None)}1528# Add any Sphinx extension module names here, as strings. They can be extensions29# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.30extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',31 'clickdoctools']16# HTML -----------------------------------------------------------------1733# Add any paths that contain templates here, relative to this directory.34templates_path = ['_templates']3536# The suffix of source filenames.37source_suffix = '.rst'3839# The encoding of source files.40#source_encoding = 'utf-8-sig'4142# The master toctree document.43master_doc = 'index'4445# General information about the project.46project = u'click'47copyright = u'%d, Armin Ronacher' % datetime.datetime.utcnow().year4849# The version info for the project you're documenting, acts as replacement for50# |version| and |release|, also used in various other places throughout the51# built documents.52#53# The short X.Y version.54version = '1.0'55# The full version, including alpha/beta/rc tags.56release = '1.0'5758# The language for content autogenerated by Sphinx. Refer to documentation59# for a list of supported languages.60#language = None6162# There are two options for replacing |today|: either, you set today to some63# non-false value, then it is used:64#today = ''65# Else, today_fmt is used as the format for a strftime call.66#today_fmt = '%B %d, %Y'6768# List of patterns, relative to source directory, that match files and69# directories to ignore when looking for source files.70exclude_patterns = ['_build']7172# The reST default role (used for this markup: `text`) to use for all documents.73#default_role = None7475# If true, '()' will be appended to :func: etc. cross-reference text.76#add_function_parentheses = True7778# If true, the current module name will be prepended to all description79# unit titles (such as .. function::).80#add_module_names = True8182# If true, sectionauthor and moduleauthor directives will be shown in the83# output. They are ignored by default.84#show_authors = False8586# A list of ignored prefixes for module index sorting.87#modindex_common_prefix = []888990# -- Options for HTML output ---------------------------------------------------9192# The theme to use for HTML and HTML Help pages. Major themes that come with93# Sphinx are currently 'default' and 'sphinxdoc'.94#html_theme = 'default'9596# Theme options are theme-specific and customize the look and feel of a theme97# further. For a list of options available for each theme, see the98# documentation.99html_theme_options = {18html_theme = "click"19html_theme_options = {"index_sidebar_logo": False}20html_context = {21 "project_links": [22 ProjectLink("Donate to Pallets", "https://palletsprojects.com/donate"),23 ProjectLink("Click Website", "https://palletsprojects.com/p/click/"),24 ProjectLink("PyPI releases", "https://pypi.org/project/Click/"),25 ProjectLink("Source Code", "https://github.com/pallets/click/"),26 ProjectLink("Issue Tracker", "https://github.com/pallets/click/issues/"),27 ]28}101102# Add any paths that contain custom themes here, relative to this directory.103#html_theme_path = ['_themes']104105# The name for this set of Sphinx documents. If None, it defaults to106# "<project> v<release> documentation".107html_title = 'click'108109# A shorter title for the navigation bar. Default is the same as html_title.110#html_short_title = None111112# The name of an image file (relative to this directory) to place at the top113# of the sidebar.114#html_logo = None115116# The name of an image file (within the static path) to use as favicon of the117# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32118# pixels large.119#html_favicon = None120121# Add any paths that contain custom static files (such as style sheets) here,122# relative to this directory. They are copied after the builtin static files,123# so a file named "default.css" will overwrite the builtin "default.css".124html_static_path = ['_static']125126# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,127# using the given strftime format.128#html_last_updated_fmt = '%b %d, %Y'129130# If true, SmartyPants will be used to convert quotes and dashes to131# typographically correct entities.132#html_use_smartypants = True133134# Custom sidebar templates, maps document names to template names.29html_sidebars = {136 'index': ['sidebarintro.html', 'sourcelink.html', 'searchbox.html'],137 '**': ['sidebarlogo.html', 'localtoc.html', 'relations.html',138 'sourcelink.html', 'searchbox.html']30 "index": ["project.html", "versions.html", "searchbox.html"],31 "**": ["localtoc.html", "relations.html", "versions.html", "searchbox.html"],32}33singlehtml_sidebars = {"index": ["project.html", "versions.html", "localtoc.html"]}34html_static_path = ["_static"]35html_favicon = "_static/click-icon.png"36html_logo = "_static/click-logo-sidebar.png"37html_title = "Click Documentation ({})".format(version)38html_show_sourcelink = False39html_domain_indices = False40html_experimental_html5_writer = True41141# Additional templates that should be rendered to pages, maps page names to142# template names.143#html_additional_pages = {}42# LaTeX ----------------------------------------------------------------43145# If false, no module index is generated.146#html_domain_indices = True147148# If false, no index is generated.149#html_use_index = True150151# If true, the index is split into individual pages for each letter.152#html_split_index = False153154# If true, links to the reST sources are added to the pages.155#html_show_sourcelink = True156157# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.158#html_show_sphinx = True159160# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.161#html_show_copyright = True162163# If true, an OpenSearch description file will be output, and all pages will164# contain a <link> tag referring to it. The value of this option must be the165# base URL from which the finished HTML is served.166#html_use_opensearch = ''167168# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").169#html_file_suffix = ''170171# Output file base name for HTML help builder.172htmlhelp_basename = 'clickdoc'173174175# -- Options for LaTeX output --------------------------------------------------176177# The paper size ('letter' or 'a4').178#latex_paper_size = 'letter'179180# The font size ('10pt', '11pt' or '12pt').181#latex_font_size = '10pt'182183# Grouping the document tree into LaTeX files. List of tuples184# (source start file, target name, title, author, documentclass [howto/manual]).44latex_documents = [186 ('index', 'click.tex', u'click documentation',187 u'Armin Ronacher', 'manual'),45 (master_doc, "Click-{}.tex".format(version), html_title, author, "manual")46]189190# The name of an image file (relative to this directory) to place at the top of191# the title page.192#latex_logo = None193194# For "manual" documents, if this is true, then toplevel headings are parts,195# not chapters.196#latex_use_parts = False197198# Additional stuff for the LaTeX preamble.199#latex_preamble = ''200201# Documents to append as an appendix to all manuals.202#latex_appendices = []203204# If false, no module index is generated.205#latex_domain_indices = True206207208# -- Options for manual page output --------------------------------------------209210# One entry per manual page. List of tuples211# (source start file, name, description, authors, manual section).212man_pages = [213 ('index', 'click', u'click documentation',214 [u'Armin Ronacher'], 1)215]216217intersphinx_mapping = {218 'http://docs.python.org/dev': None219}
modified:docs/documentation.rst+34 added
76 unmodified lines
77 invoke(cli, args=['--help'])7879.. _doc-meta-variables:8081Truncating Help Texts82---------------------8384Click gets command help text from function docstrings. However if you85already use docstrings to document function arguments you may not want86to see :param: and :return: lines in your help text.8788You can use the ``\f`` escape marker to have Click truncate the help text89after the marker.9091Example:9293.. click:example::9495 @click.command()96 @click.pass_context97 def cli(ctx):98 """First paragraph.99100 This is a very long second101 paragraph and not correctly102 wrapped but it will be rewrapped.103 \f104105 :param click.core.Context ctx: Click context.106 """107108And what it looks like:109110.. click:run::111112 invoke(cli, args=['--help'])113114115Meta Variables116--------------117118Options and parameters accept a ``metavar`` argument that can change the
79 unmodified lines
modified:docs/index.rst+11 added-4 removed
1Welcome to the Click Documentation2==================================1.. rst-class:: hide-header23Welcome to Click4================56.. image:: _static/click-logo.png7 :align: center8 :scale: 50%9 :target: https://palletsprojects.com/p/click/1011Click is a Python package for creating beautiful command line interfaces12in a composable way with as little code as necessary. It's the "Command13Line Interface Creation Kit". It's highly configurable but comes with14sensible defaults out of the box.
41 unmodified lines
56You can get the library directly from PyPI::5758 pip install click5953Documentation Contents54----------------------60Documentation61-------------6263This part of the documentation guides you through all of the library's64usage patterns.65
42 unmodified lines
modified:docs/make.bat+18 added-137 removed
1@ECHO OFF23pushd %~dp045REM Command file for Sphinx documentation67if "%SPHINXBUILD%" == "" (8 set SPHINXBUILD=sphinx-build9)10set SOURCEDIR=.11set BUILDDIR=_build9set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .10if NOT "%PAPER%" == "" (11 set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%12)12set SPHINXPROJ=Jinja1314if "%1" == "" goto help1516if "%1" == "help" (17 :help18 echo.Please use `make ^<target^>` where ^<target^> is one of19 echo. html to make standalone HTML files20 echo. dirhtml to make HTML files named index.html in directories21 echo. singlehtml to make a single large HTML file22 echo. pickle to make pickle files23 echo. json to make JSON files24 echo. htmlhelp to make HTML files and a HTML help project25 echo. qthelp to make HTML files and a qthelp project26 echo. devhelp to make HTML files and a Devhelp project27 echo. epub to make an epub28 echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter29 echo. text to make text files30 echo. man to make manual pages31 echo. changes to make an overview over all changed/added/deprecated items32 echo. linkcheck to check all external links for integrity33 echo. doctest to run all doctests embedded in the documentation if enabled34 goto end35)3637if "%1" == "clean" (38 for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i39 del /q /s %BUILDDIR%\*40 goto end41)4243if "%1" == "html" (44 %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html16%SPHINXBUILD% >NUL 2>NUL17if errorlevel 9009 (18 echo.46 echo.Build finished. The HTML pages are in %BUILDDIR%/html.47 goto end48)4950if "%1" == "dirhtml" (51 %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml19 echo.The 'sphinx-build' command was not found. Make sure you have Sphinx20 echo.installed, then set the SPHINXBUILD environment variable to point21 echo.to the full path of the 'sphinx-build' executable. Alternatively you22 echo.may add the Sphinx directory to PATH.23 echo.53 echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.54 goto end24 echo.If you don't have Sphinx installed, grab it from25 echo.http://sphinx-doc.org/26 exit /b 127)2857if "%1" == "singlehtml" (58 %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml59 echo.60 echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.61 goto end62)29%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%30goto end3164if "%1" == "pickle" (65 %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle66 echo.67 echo.Build finished; now you can process the pickle files.68 goto end69)32:help33%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%3471if "%1" == "json" (72 %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json73 echo.74 echo.Build finished; now you can process the JSON files.75 goto end76)7778if "%1" == "htmlhelp" (79 %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp80 echo.81 echo.Build finished; now you can run HTML Help Workshop with the ^82.hhp project file in %BUILDDIR%/htmlhelp.83 goto end84)8586if "%1" == "qthelp" (87 %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp88 echo.89 echo.Build finished; now you can run "qcollectiongenerator" with the ^90.qhcp project file in %BUILDDIR%/qthelp, like this:91 echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Classy.qhcp92 echo.To view the help file:93 echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Classy.ghc94 goto end95)9697if "%1" == "devhelp" (98 %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp99 echo.100 echo.Build finished.101 goto end102)103104if "%1" == "epub" (105 %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub106 echo.107 echo.Build finished. The epub file is in %BUILDDIR%/epub.108 goto end109)110111if "%1" == "latex" (112 %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex113 echo.114 echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.115 goto end116)117118if "%1" == "text" (119 %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text120 echo.121 echo.Build finished. The text files are in %BUILDDIR%/text.122 goto end123)124125if "%1" == "man" (126 %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man127 echo.128 echo.Build finished. The manual pages are in %BUILDDIR%/man.129 goto end130)131132if "%1" == "changes" (133 %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes134 echo.135 echo.The overview file is in %BUILDDIR%/changes.136 goto end137)138139if "%1" == "linkcheck" (140 %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck141 echo.142 echo.Link check complete; look for any errors in the above output ^143or in %BUILDDIR%/linkcheck/output.txt.144 goto end145)146147if "%1" == "doctest" (148 %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest149 echo.150 echo.Testing of doctests in the sources finished, look at the ^151results in %BUILDDIR%/doctest/output.txt.152 goto end153)15435:end36popd
modified:docs/Makefile+10 added-120 removed
1# Makefile for Sphinx documentation1# Minimal makefile for Sphinx documentation2#34# You can set these variables from the command line.5SPHINXOPTS =6SPHINXBUILD = sphinx-build7PAPER =7SPHINXPROJ = Jinja8SOURCEDIR = .9BUILDDIR = _build1010# Internal variables.11PAPEROPT_a4 = -D latex_paper_size=a412PAPEROPT_letter = -D latex_paper_size=letter13ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .1415.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest1611# Put it first so that "make" without argument is like "make help".12help:18 @echo "Please use \`make <target>' where <target> is one of"19 @echo " html to make standalone HTML files"20 @echo " dirhtml to make HTML files named index.html in directories"21 @echo " singlehtml to make a single large HTML file"22 @echo " pickle to make pickle files"23 @echo " json to make JSON files"24 @echo " htmlhelp to make HTML files and a HTML help project"25 @echo " qthelp to make HTML files and a qthelp project"26 @echo " devhelp to make HTML files and a Devhelp project"27 @echo " epub to make an epub"28 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"29 @echo " latexpdf to make LaTeX files and run them through pdflatex"30 @echo " text to make text files"31 @echo " man to make manual pages"32 @echo " changes to make an overview of all changed/added/deprecated items"33 @echo " linkcheck to check all external links for integrity"34 @echo " doctest to run all doctests embedded in the documentation (if enabled)"13 @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)1436clean:37 -rm -rf $(BUILDDIR)/*15.PHONY: help Makefile1639html:40 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html41 @echo42 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."4344dirhtml:45 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml46 @echo47 @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."4849singlehtml:50 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml51 @echo52 @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."5354pickle:55 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle56 @echo57 @echo "Build finished; now you can process the pickle files."5859json:60 $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json61 @echo62 @echo "Build finished; now you can process the JSON files."6364htmlhelp:65 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp66 @echo67 @echo "Build finished; now you can run HTML Help Workshop with the" \68 ".hhp project file in $(BUILDDIR)/htmlhelp."6970qthelp:71 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp72 @echo73 @echo "Build finished; now you can run "qcollectiongenerator" with the" \74 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"75 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Classy.qhcp"76 @echo "To view the help file:"77 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Classy.qhc"7879devhelp:80 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp81 @echo82 @echo "Build finished."83 @echo "To view the help file:"84 @echo "# mkdir -p $$HOME/.local/share/devhelp/Classy"85 @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Classy"86 @echo "# devhelp"8788epub:89 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub90 @echo91 @echo "Build finished. The epub file is in $(BUILDDIR)/epub."9293latex:94 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex95 @echo96 @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."97 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \98 "run these through (pdf)latex."99100latexpdf: latex101 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex102 @echo "Running LaTeX files through pdflatex..."103 make -C $(BUILDDIR)/latex all-pdf104 @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."105106text:107 $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text108 @echo109 @echo "Build finished. The text files are in $(BUILDDIR)/text."110111man:112 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man113 @echo114 @echo "Build finished. The manual pages are in $(BUILDDIR)/man."115116changes:117 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes118 @echo119 @echo "The overview file is in $(BUILDDIR)/changes."120121linkcheck:122 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck123 @echo124 @echo "Link check complete; look for any errors in the above output " \125 "or in $(BUILDDIR)/linkcheck/output.txt."126127doctest:128 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest129 @echo "Testing of doctests in the sources finished, look at the " \130 "results in $(BUILDDIR)/doctest/output.txt."17# Catch-all target: route all unknown targets to Sphinx using the new18# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).19%: Makefile20 @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
modified:docs/options.rst+5 added-5 removed
60 unmodified lines
61.. click:example::6263 # How to use a Python reserved word such as `from` as a parameter64 @click.command()65 @click.option('--from', '-f', '_from')65 @click.option('--from', '-f', 'from_')66 @click.option('--to', '-t')67 def reserved_param_name(_from, to):68 click.echo('from %s to %s' % (_from, to))67 def reserved_param_name(from_, to):68 click.echo('from %s to %s' % (from_, to))6970And on the command line:7172.. click:run::
50 unmodified lines
123124.. click:example::125126 @click.command()127 @click.option('--item', type=(unicode, int))127 @click.option('--item', type=(str, int))128 def putitem(item):129 click.echo('name=%s id=%d' % item)130131And on the command line:
8 unmodified lines
140141.. click:example::142143 @click.command()144 @click.option('--item', nargs=2, type=click.Tuple([unicode, int]))144 @click.option('--item', nargs=2, type=click.Tuple([str, int]))145 def putitem(item):146 click.echo('name=%s id=%d' % item)147148Multiple Options
648 unmodified lines
modified:docs/parameters.rst+3 added
89 unmodified lines
90If all names for a parameter contain dashes, the internal name is generated91automatically by taking the longest argument and converting all dashes to92underscores.9394The internal name is converted to lowercase.9596Examples:9798* For an option with ``('-f', '--foo-bar')``, the parameter name is `foo_bar`.99* For an option with ``('-x',)``, the parameter is `x`.100* For an option with ``('-f', '--filename', 'dest')``, the parameter name is `dest`.101* For an option with ``('--CamelCaseOption',)``, the parameter is `camelcaseoption`.102* For an arguments with ``(`foogle`)``, the parameter name is `foogle`. To103 provide a different human readable name for use in help text, see the section104 about :ref:`doc-meta-variables`.105
31 unmodified lines
added:docs/requirements.txt+2 added
1Sphinx~=1.7.72Pallets-Sphinx-Themes~=1.1.0
modified:docs/testing.rst+5 added
59 unmodified lines
60 assert result.exit_code == 061 assert 'Debug mode is on' in result.output62 assert 'Syncing' in result.output6364Additional keyword arguments passed to ``.invoke()`` will be used to construct the initial Context object. For example, if you want to run your tests against a fixed terminal width you can use the following::6566 runner = CliRunner()67 result = runner.invoke(cli, ['--debug', 'sync'], terminal_width=60)6869File System Isolation70---------------------7172For basic command line tools that want to operate with the file system, the
46 unmodified lines
modified:tests/test_context.py+53 added
191 unmodified lines
192 @click.command()193 @click.pass_context194 def cli(ctx):195 ctx.obj = 'test'196197 @ctx.call_on_close198 def foo():199 assert click.get_current_context().obj == 'test'200 called.append(True)
2 unmodified lines
203 result = runner.invoke(cli, [])204 assert not result.exception205 assert result.output == 'aha!\n'206 assert called == [True]207208209def test_make_pass_decorator_args(runner):210 """211 Test to check that make_pass_decorator doesn't consume arguments based on212 invocation order.213 """214 class Foo(object):215 title = 'foocmd'216217 pass_foo = click.make_pass_decorator(Foo)218219 @click.group()220 @click.pass_context221 def cli(ctx):222 ctx.obj = Foo()223224 @cli.command()225 @click.pass_context226 @pass_foo227 def test1(foo, ctx):228 click.echo(foo.title)229230 @cli.command()231 @pass_foo232 @click.pass_context233 def test2(ctx, foo):234 click.echo(foo.title)235236 result = runner.invoke(cli, ['test1'])237 assert not result.exception238 assert result.output == 'foocmd\n'239240 result = runner.invoke(cli, ['test2'])241 assert not result.exception242 assert result.output == 'foocmd\n'243244245def test_exit_not_standalone():246 @click.command()247 @click.pass_context248 def cli(ctx):249 ctx.exit(1)250251 assert cli.main([], 'test_exit_not_standalone', standalone_mode=False) == 1252253 @click.command()254 @click.pass_context255 def cli(ctx):256 ctx.exit(0)257258 assert cli.main([], 'test_exit_not_standalone', standalone_mode=False) == 0
modified:tests/test_formatting.py+29 added
266 unmodified lines
267 '',268 'Options:',269 ' --help Show this message and exit.'270 ]271272273def test_truncating_docstring(runner):274 @click.command()275 @click.pass_context276 def cli(ctx):277 """First paragraph.278279 This is a very long second280 paragraph and not correctly281 wrapped but it will be rewrapped.282 \f283284 :param click.core.Context ctx: Click context.285 """286287 result = runner.invoke(cli, ['--help'], terminal_width=60)288 assert not result.exception289 assert result.output.splitlines() == [290 'Usage: cli [OPTIONS]',291 '',292 ' First paragraph.',293 '',294 ' This is a very long second paragraph and not correctly',295 ' wrapped but it will be rewrapped.',296 '',297 'Options:',298 ' --help Show this message and exit.',299 ]
modified:tests/test_testing.py+30 added
152 unmodified lines
153 click.echo('hello world')154 sys.exit('error')155156 @click.command()157 @click.pass_context158 def cli_string_ctx_exit(ctx):159 click.echo('hello world')160 ctx.exit('error')161162 @click.command()163 def cli_int():164 click.echo('hello world')165 sys.exit(1)166167 @click.command()168 @click.pass_context169 def cli_int_ctx_exit(ctx):170 click.echo('hello world')171 ctx.exit(1)172173 @click.command()174 def cli_float():175 click.echo('hello world')176 sys.exit(1.0)177178 @click.command()179 @click.pass_context180 def cli_float_ctx_exit(ctx):181 click.echo('hello world')182 ctx.exit(1.0)183184 @click.command()185 def cli_no_error():186 click.echo('hello world')187188 runner = CliRunner()
1 unmodified line
190 result = runner.invoke(cli_string)191 assert result.exit_code == 1192 assert result.output == 'hello world\nerror\n'193194 result = runner.invoke(cli_string_ctx_exit)195 assert result.exit_code == 1196 assert result.output == 'hello world\nerror\n'197198 result = runner.invoke(cli_int)199 assert result.exit_code == 1200 assert result.output == 'hello world\n'201202 result = runner.invoke(cli_int_ctx_exit)203 assert result.exit_code == 1204 assert result.output == 'hello world\n'205206 result = runner.invoke(cli_float)207 assert result.exit_code == 1208 assert result.output == 'hello world\n1.0\n'209210 result = runner.invoke(cli_float_ctx_exit)211 assert result.exit_code == 1212 assert result.output == 'hello world\n1.0\n'213214 result = runner.invoke(cli_no_error)215 assert result.exit_code == 0216 assert result.output == 'hello world\n'217
72 unmodified lines
modified:CHANGES.rst+201 added-225 removed
1Click Changelog2===============34This contains all major version changes between Click releases.45Version 7.06-----------79(upcoming release with new features, release date to be decided)8Unreleased911- Updated test env matrix. (`#1027`_)12- Fixes a ZeroDivisionError in ProgressBar.make_step,13 when the arg passed to the first call of ProgressBar.update is 0. (`#1012`_)(`#447`_)14- Document that options can be required=True. (`#1022`_)(`#514`_)15- Fix path validation bug. (`#1020`_)(`#795`_)16- Document customizing option names. (`#1016`_)(`#725`_)17- Wrap click.Choice's missing message. (`#1000`_)(`#202`_)18- Don't add newlines by default for progressbars. (`#1013`_)19- Document how `auto_envar_prefix` works with command groups. (`#1011`_)20- Fix failing bash completion function test signature.21- Clarify how paramteres are named. (`#1009`_)(`#949`_)22- Document bytestripping behavior of CliRunner. (`#1010`_)(`#334`_)23- Fix Google App Engine ImportError. (`#995`_)24- Document that ANSI color info isn't parsedfrom bytearrays in Python 2. (`#334`_)25- Add note to documentation on how parameters are named.26- Fix formatting for short help. (`#1008`_)27- Extract bar formatting to its own method. (`#414`_)28- Move `fcntl` import. (`#965`_)29- Fixed issues where `fd` was undefined. (`#1007`_)30- Added deprecation flag to commands. (`#1005`_)31- Fix various Sphinx errors. (`#883`_)32- Add `case_sensitive=False` as an option to Choice types. (`#887`_)33- Add details about Python version support. (`#1004`_)34- Clarify documentation on command line options. (`#1003`_)(`#741`_)35- Add `case_sensitive=False` as an option to Choice. (`#569`_)36- Better handling of help text for dynamic default option values. (`#996`_)37- Allow short width to address cmd formatting. (`#1002`_)38- Add test case checking for custom param type. (`#1001`_)39- Make `Argument.make_metavar()` default to type metavar. (`#675`_)40- Show progressbar only if total execution time is visible. (`#487`_)41- Allow setting `prog_name` as extra in `CliRunner.invoke` (`#999`_)(`#616`_)42- Add support for Sphinx 1.7+ (`#991`_)43- Fix `get_winter_size()` so it correctly returns (0,0). (`#997`_)44- Update progress after iteration. (`#706`_)(`#651`_)45- Add `show_envvar` for showing environment variables in help. (`#710`_)46- Add support for bright colors. (`#809`_)47- Add documentation for `ignore_unkown_options`. (`#684`_)48- Allow CliRunner to separate stdout and stderr. (`#868`_)49- Implement streaming pager. (`#889`_)(`#409`_)50- Progress bar now uses stderr by default. (`#863`_)51- Do not set options twice. (`#962`_)52- Add Py2/ unicode / str compatability for doc tools. (`#993`_)(`#719`_)53- Add copy option attrs so that custom classes can be re-used. (`#994`_)(`#926`_)54- `param_hint` in errors now derived from param itself. (`#709`_)(`#704`_)(`#598`_)55- Add a test that ensures that when an Argument is formatted into a usage error,56 its metavar is used, not its name. (`#612`_)57- Fix variable precedence. (`#874`_)(`#873`_)58- Fix ResourceWarning that occurs during some tests. (`#878`_)59- Update README to match flask style and add `long_description` to setup.py. (`#990`_)60- Drop testing for 2.6 3.3 and 3.6.61- Make locale optional (`#880`_)62- Fix invalid escape sequences. (`#877`_)63- Added workaround for jupyter. (`#918`_)64- x and a filemodes now use stdout when file is '-'. (`#929`_)65- _AtomicFile now uses the realpath of the original filename. (`#920`_)66- Fix missing comma in `__all__` list (`#935`_)67- Raw strings added so correct escaping occurs. (`#807`_)68- Add bool conversion for t and f. (`#842`_)69- Update doc to match arg name for path_type. (`#801`_)70- Add bright colors support for `click.style`71 and fix the reset option for parameters fg and bg. (`#703`_)72- Add test and documentation for Option naming: functionality. (`#799`_)73- Use deterministic option name; can't rely on list sort. (`#794`_)(`#793`_)74- Added support for bash completions containing spaces. (`#773`_)75- Added support for dynamic bash completion from a user-supplied callback.76 (`#755`_)77- Fix bug that caused bashcompletion to give improper completions on78 chained commands when a required option/argument was being completed.79 (`#790`_)(`#806`_)80- Allow autocompletion function to determine whether or not to return81 completions that start with the incomplete argument.82- Add native ZSH autocompletion support. (`#323`_)(`#865`_)83- Add support for auto-completion documentation. (`#866`_)(`#869`_)84- Added support for bash completion of type=click.Choice for Options and85 Arguments. (`#535`_)86- Fix bug that caused bashcompletion to give improper completions on87 chained commands. (`#774`_)88- Fix completion of subcommand options after last argument (`#919`_)89- Fix incorrect completions when defaults are present (`#925`_)90- The user is now presented with the available choices if prompt=True and91 type=click.Choice in a click.option. The choices are listed within92 parenthesis like 'Choose fruit (apple, orange): '.93- The exception objects now store unicode properly.94- Added the ability to hide commands and options from help.95- Added Float Range in Types.96- `secho`'s first argument can now be `None`, like in `echo`.97- Usage errors now hint at the `--help` option.98- ``launch`` now works properly under Cygwin. (`#650`_)99- `CliRunner.invoke` now may receive `args` as a string representing100 a Unix shell command. See (`#664`_).101- Add support for bright colors.102- 't' and 'f' are now converted to True and False.103- Subcommands that are named by the function now automatically have the104 underscore replaced with a dash. So if you register a function named105 `my_command` it becomes `my-command` in the command line interface.106- Stdout is now automatically set to non blocking.107- Use realpath to convert atomic file internally into its full canonical108 path so that changing working directories does not harm it.109- Force stdout/stderr writable. This works around issues with badly patched110 standard streams like those from jupyter.10- Drop support for Python 2.6 and 3.3. (`#976`_)11- Wrap ``click.Choice``'s missing message. (`#202`_, `#1000`_)12- Add native ZSH autocompletion support. (`#323`_, `#865`_)13- Document that ANSI color info isn't parsed from bytearrays in Python 2. (`#334`_)14- Document byte-stripping behavior of ``CliRunner``. (`#334`_, `#1010`_)15- Usage errors now hint at the ``--help`` option. (`#393`_, `#557`_)16- Implement streaming pager. (`#409`_, `#889`_)17- Extract bar formatting to its own method. (`#414`_)18- ``secho``'s first argument can now be ``None``, like in ``echo``. (`#424`_)19- Fixes a ``ZeroDivisionError`` in ``ProgressBar.make_step``, when the arg passed to the first call of ``ProgressBar.update`` is 0. (`#447`_, `#1012`_)20- Show progressbar only if total execution time is visible. (`#487`_)21- Added the ability to hide commands and options from help. (`#500`_)22- Document that options can be ``required=True``. (`#514`_, `#1022`_)23- Non-standalone calls to ``Context.exit`` return the exit code, rather than calling ``sys.exit``. (`#533`_, `#667`_)24- Added ``FloatRange`` type. (`#538`_, `#553`_)25- Added support for bash completion of ``type=click.Choice`` for ``Options`` and ``Arguments``. (`#535`_)26- Add ``case_sensitive=False`` as an option to Choice. (`#569`_)27- ``param_hint`` in errors now derived from param itself. (`#598`_, `#704`_, `#709`_)28- Add a test that ensures that when an argument is formatted into a usage error, its metavar is used, not its name. (`#612`_)29- Allow setting ``prog_name`` as extra in ``CliRunner.invoke``. (`#616`_, `#999`_)30- ``launch`` now works properly under Cygwin. (`#650`_)31- Update progress after iteration. (`#651`_, `#706`_)32- ``CliRunner.invoke`` now may receive ``args`` as a string representing a Unix shell command. (`#664`_)33- Make ``Argument.make_metavar()`` default to type metavar. (`#675`_)34- Add documentation for ``ignore_unkown_options``. (`#684`_)35- Add bright colors support for ``click.style`` and fix the reset option for parameters ``fg`` and ``bg``. (`#703`_, `#809`_)36- Add ``show_envvar`` for showing environment variables in help. (`#710`_)37- Document customizing option names. (`#725`_, `#1016`_)38- Disable ``sys._getframes()`` on Python interpreters that don't support it. (`#728`_)39- Fix bug in test runner when calling ``sys.exit`` with ``None``. (`#739`_)40- Clarify documentation on command line options. (`#741`_, `#1003`_)41- Fix crash on Windows console. (`#744`_)42- Fix bug that caused bash completion to give improper completions on chained commands. (`#754`_, `#774`_, `#790`_, `#806`_)43- Added support for dynamic bash completion from a user-supplied callback. (`#755`_)44- Added support for bash completions containing spaces. (`#773`_)45- Fix option naming routine to match documentation. (`#793`_)46- Use deterministic option name; can't rely on list sort. (`#793`_, `#794`_)47- Fix path validation bug. (`#795`_, `#1020`_)48- Add test and documentation for ``Option`` naming: functionality. (`#799`_)49- Update doc to match arg name for ``path_type``. (`#801`_)50- Raw strings added so correct escaping occurs. (`#807`_)51- Add bool conversion for "t" and "f". (`#842`_)52- Fixed the behavior of Click error messages with regards to unicode on 2.x and 3.x. Message is now always unicode and the str and unicode special methods work as you expect on that platform. (`#862`_)53- Progress bar now uses stderr by default. (`#863`_)54- Add support for auto-completion documentation. (`#866`_, `#869`_)55- Allow ``CliRunner`` to separate stdout and stderr. (`#868`_)56- Fix variable precedence. (`#873`_, `#874`_)57- Allow autocompletion function to determine whether or not to return completions that start with the incomplete argument. (`#869`_)58- Fix invalid escape sequences. (`#877`_)59- Fix ``ResourceWarning`` that occurs during some tests. (`#878`_)60- When detecting a misconfigured locale, don't fail if the ``locale`` command fails. (`#880`_)61- Add ``case_sensitive=False`` as an option to ``Choice`` types. (`#887`_)62- Force stdout/stderr writable. This works around issues with badly patched standard streams like those from Jupyter. (`#918`_)63- ``_AtomicFile`` now uses the ``realpath`` of the original filename so that chaning the working directory does not affect it. (`#920`_)64- Add copy option attrs so that custom classes can be re-used. (`#926`_, `#994`_)65- "x" and "a" file modes now use stdout when file is ``"-"``. (`#929`_)66- Fix missing comma in ``__all__`` list. (`#935`_)67- Clarify how parameters are named. (`#949`_, `#1009`_)68- Stdout is now automatically set to non blocking. (`#954`_)69- Do not set options twice. (`#962`_)70- Move ``fcntl`` import. (`#965`_)71- Fix Google App Engine ``ImportError``. (`#995`_)72- Better handling of help text for dynamic default option values. (`#996`_)73- Fix completion of subcommand options after last argument (`#919`_)74- Fix incorrect completions when defaults are present (`#925`_)75- Fix ``get_winter_size()`` so it correctly returns ``(0,0)``. (`#997`_)76- Add test case checking for custom param type. (`#1001`_)77- Allow short width to address cmd formatting. (`#1002`_)78- Add details about Python version support. (`#1004`_)79- Added deprecation flag to commands. (`#1005`_)80- Fixed issues where ``fd`` was undefined. (`#1007`_)81- Fix formatting for short help. (`#1008`_)82- Document how ``auto_envar_prefix`` works with command groups. (`#1011`_)83- Don't add newlines by default for progress bars. (`#1013`_)84- Document that parameter names are lowercased by default. (`#1055`_)85- Subcommands that are named by the function now automatically have the underscore replaced with a dash. If you register a function named ``my_command`` it becomes ``my-command`` in the command line interface.86112.. _#866: https://github.com/pallets/click/issues/866113.. _#919: https://github.com/pallets/click/issues/919114.. _#925: https://github.com/pallets/click/issues/925115.. _#1027: https://github.com/pallets/click/pull/1027116.. _#1012: https://github.com/pallets/click/pull/1012117.. _#447: https://github.com/pallets/click/issues/447118.. _#1022: https://github.com/pallets/click/pull/1022119.. _#869: https://github.com/pallets/click/pull/869120.. _#866: https://github.com/pallets/click/issues/866121.. _#514: https://github.com/pallets/click/issues/514122.. _#1020: https://github.com/pallets/click/pull/1020123.. _#795: https://github.com/pallets/click/issues/795124.. _#1016: https://github.com/pallets/click/pull/1016125.. _#725: https://github.com/pallets/click/issues/725126.. _#1000: https://github.com/pallets/click/pull/100087.. _#202: https://github.com/pallets/click/issues/202128.. _#1013: https://github.com/pallets/click/pull/1013129.. _#1011: https://github.com/pallets/click/pull/1011130.. _#865: https://github.com/pallets/click/pull/86588.. _#323: https://github.com/pallets/click/issues/323132.. _#1009: https://github.com/pallets/click/pull/1009133.. _#949: https://github.com/pallets/click/issues/949134.. _#1010: https://github.com/pallets/click/pull/101089.. _#334: https://github.com/pallets/click/issues/334136.. _#995: https://github.com/pallets/click/pull/995137.. _#1008: https://github.com/pallets/click/pull/100890.. _#393: https://github.com/pallets/click/issues/39391.. _#409: https://github.com/pallets/click/issues/40992.. _#414: https://github.com/pallets/click/pull/414139.. _#965: https://github.com/pallets/click/pull/965140.. _#1005: https://github.com/pallets/click/pull/1005141.. _#883: https://github.com/pallets/click/pull/883142.. _#887: https://github.com/pallets/click/pull/887143.. _#1004: https://github.com/pallets/click/pull/1004144.. _#1003: https://github.com/pallets/click/pull/1003145.. _#741: https://github.com/pallets/click/issues/741146.. _#569: https://github.com/pallets/click/pull/569147.. _#1007: https://github.com/pallets/click/pull/1007148.. _#996: https://github.com/pallets/click/pull/996149.. _#1002: https://github.com/pallets/click/pull/1002150.. _#1001: https://github.com/pallets/click/pull/1001151.. _#675: https://github.com/pallets/click/pull/67593.. _#424: https://github.com/pallets/click/pull/42494.. _#447: https://github.com/pallets/click/issues/44795.. _#487: https://github.com/pallets/click/pull/487153.. _#999: https://github.com/pallets/click/pull/99996.. _#500: https://github.com/pallets/click/pull/50097.. _#514: https://github.com/pallets/click/issues/51498.. _#533: https://github.com/pallets/click/issues/53399.. _#535: https://github.com/pallets/click/pull/535100.. _#538: https://github.com/pallets/click/pull/538101.. _#553: https://github.com/pallets/click/pull/553102.. _#557: https://github.com/pallets/click/pull/557103.. _#569: https://github.com/pallets/click/pull/569104.. _#598: https://github.com/pallets/click/issues/598105.. _#612: https://github.com/pallets/click/pull/612106.. _#616: https://github.com/pallets/click/issues/616155.. _#991: https://github.com/pallets/click/pull/991156.. _#997: https://github.com/pallets/click/pull/997157.. _#706: https://github.com/pallets/click/pull/706107.. _#650: https://github.com/pallets/click/pull/650108.. _#651: https://github.com/pallets/click/issues/651109.. _#664: https://github.com/pallets/click/pull/664110.. _#667: https://github.com/pallets/click/pull/667111.. _#675: https://github.com/pallets/click/pull/675112.. _#684: https://github.com/pallets/click/pull/684113.. _#703: https://github.com/pallets/click/issues/703114.. _#704: https://github.com/pallets/click/issues/704115.. _#706: https://github.com/pallets/click/pull/706116.. _#709: https://github.com/pallets/click/pull/709117.. _#710: https://github.com/pallets/click/pull/710118.. _#719: https://github.com/pallets/click/issues/719119.. _#725: https://github.com/pallets/click/issues/725120.. _#728: https://github.com/pallets/click/issues/728121.. _#739: https://github.com/pallets/click/issues/739122.. _#741: https://github.com/pallets/click/issues/741123.. _#744: https://github.com/pallets/click/issues/744124.. _#754: https://github.com/pallets/click/pull/754125.. _#755: https://github.com/pallets/click/pull/755126.. _#773: https://github.com/pallets/click/pull/773127.. _#774: https://github.com/pallets/click/pull/774128.. _#790: https://github.com/pallets/click/pull/790129.. _#793: https://github.com/pallets/click/issues/793130.. _#794: https://github.com/pallets/click/pull/794131.. _#795: https://github.com/pallets/click/issues/795132.. _#799: https://github.com/pallets/click/pull/799133.. _#801: https://github.com/pallets/click/pull/801134.. _#806: https://github.com/pallets/click/pull/806135.. _#807: https://github.com/pallets/click/pull/807136.. _#809: https://github.com/pallets/click/pull/809161.. _#868: https://github.com/pallets/click/pull/868162.. _#889: https://github.com/pallets/click/pull/889163.. _#409: https://github.com/pallets/click/issues/409137.. _#842: https://github.com/pallets/click/pull/842138.. _#862: https://github.com/pallets/click/pull/862139.. _#863: https://github.com/pallets/click/pull/863165.. _#962: https://github.com/pallets/click/pull/962166.. _#993: https://github.com/pallets/click/pull/993167.. _#994: https://github.com/pallets/click/pull/994168.. _#926: https://github.com/pallets/click/issues/926169.. _#709: https://github.com/pallets/click/pull/709170.. _#612: https://github.com/pallets/click/pull/612171.. _#704: https://github.com/pallets/click/issues/704172.. _#598: https://github.com/pallets/click/issues/598173.. _#719: https://github.com/pallets/click/issues/719174.. _#874: https://github.com/pallets/click/pull/874140.. _#865: https://github.com/pallets/click/pull/865141.. _#866: https://github.com/pallets/click/issues/866142.. _#868: https://github.com/pallets/click/pull/868143.. _#869: https://github.com/pallets/click/pull/869144.. _#873: https://github.com/pallets/click/issues/873176.. _#990: https://github.com/pallets/click/pull/990177.. _#684: https://github.com/pallets/click/pull/684145.. _#874: https://github.com/pallets/click/pull/874146.. _#877: https://github.com/pallets/click/pull/877147.. _#878: https://github.com/pallets/click/pull/878148.. _#880: https://github.com/pallets/click/issues/880180.. _#877: https://github.com/pallets/click/pull/877149.. _#883: https://github.com/pallets/click/pull/883150.. _#887: https://github.com/pallets/click/pull/887151.. _#889: https://github.com/pallets/click/pull/889152.. _#918: https://github.com/pallets/click/pull/918182.. _#929: https://github.com/pallets/click/pull/929153.. _#919: https://github.com/pallets/click/issues/919154.. _#920: https://github.com/pallets/click/pull/920155.. _#925: https://github.com/pallets/click/issues/925156.. _#926: https://github.com/pallets/click/issues/926157.. _#929: https://github.com/pallets/click/pull/929158.. _#935: https://github.com/pallets/click/pull/935185.. _#807: https://github.com/pallets/click/pull/807186.. _#806: https://github.com/pallets/click/pull/806187.. _#842: https://github.com/pallets/click/pull/842188.. _#801: https://github.com/pallets/click/pull/801189.. _#703: https://github.com/pallets/click/issues/703190.. _#799: https://github.com/pallets/click/pull/799191.. _#794: https://github.com/pallets/click/pull/794192.. _#793: https://github.com/pallets/click/issues/793193.. _#773: https://github.com/pallets/click/pull/773194.. _#755: https://github.com/pallets/click/pull/755195.. _#535: https://github.com/pallets/click/pull/535196.. _#650: https://github.com/pallets/click/pull/650197.. _#664: https://github.com/pallets/click/pull/664198.. _#774: https://github.com/pallets/click/pull/774199.. _#790: https://github.com/pallets/click/pull/790159.. _#949: https://github.com/pallets/click/issues/949160.. _#954: https://github.com/pallets/click/issues/954161.. _#962: https://github.com/pallets/click/pull/962162.. _#965: https://github.com/pallets/click/pull/965163.. _#976: https://github.com/pallets/click/pull/976164.. _#990: https://github.com/pallets/click/pull/990165.. _#991: https://github.com/pallets/click/pull/991166.. _#993: https://github.com/pallets/click/pull/993167.. _#994: https://github.com/pallets/click/pull/994168.. _#995: https://github.com/pallets/click/pull/995169.. _#996: https://github.com/pallets/click/pull/996170.. _#997: https://github.com/pallets/click/pull/997171.. _#999: https://github.com/pallets/click/pull/999172.. _#1000: https://github.com/pallets/click/pull/1000173.. _#1001: https://github.com/pallets/click/pull/1001174.. _#1002: https://github.com/pallets/click/pull/1002175.. _#1003: https://github.com/pallets/click/pull/1003176.. _#1004: https://github.com/pallets/click/pull/1004177.. _#1005: https://github.com/pallets/click/pull/1005178.. _#1007: https://github.com/pallets/click/pull/1007179.. _#1008: https://github.com/pallets/click/pull/1008180.. _#1009: https://github.com/pallets/click/pull/1009181.. _#1010: https://github.com/pallets/click/pull/1010182.. _#1011: https://github.com/pallets/click/pull/1011183.. _#1012: https://github.com/pallets/click/pull/1012184.. _#1013: https://github.com/pallets/click/pull/1013185.. _#1016: https://github.com/pallets/click/pull/1016186.. _#1020: https://github.com/pallets/click/pull/1020187.. _#1022: https://github.com/pallets/click/pull/1022188.. _#1027: https://github.com/pallets/click/pull/1027189.. _#1055: https://github.com/pallets/click/pull/1055190201Version 6.8202-----------191204(bugfix release; yet to be released)205206- Disabled sys._getframes() on Python interpreters that don't support it. See207 #728.208- Fix bug in test runner when calling ``sys.exit`` with ``None``. See #739.209- Fix crash on Windows console, see #744.210- Fix bashcompletion on chained commands. See #754.211- Fix option naming routine to match documentation. See #793212- Fixed the behavior of click error messages with regards to unicode on 2.x213 and 3.x respectively. Message is now always unicode and the str and unicode214 special methods work as you expect on that platform.215192Version 6.7193-----------194195(bugfix release; released on January 6th 2017)196221- Make `click.progressbar` work with `codecs.open` files. See #637.197- Make ``click.progressbar`` work with ``codecs.open`` files. See #637.198- Fix bug in bash completion with nested subcommands. See #639.199- Fix test runner not saving caller env correctly. See #644.200- Fix handling of SIGPIPE. See #626201- Deal with broken Windows environments such as Google App Engine's. See #711.
2 unmodified lines
204-----------205206(bugfix release; released on April 4th 2016)207232- Fix bug in `click.Path` where it would crash when passed a `-`. See #551.208- Fix bug in ``click.Path`` where it would crash when passed a ``-``. See #551.209210Version 6.4211-----------212
6 unmodified lines
219-----------220221(bugfix release; released on February 22 2016)222247- Fix argument checks for interpreter invoke with `-m` and `-c`223- Fix argument checks for interpreter invoke with ``-m`` and ``-c``224 on Windows.225- Fixed a bug that cased locale detection to error out on Python 3.226227Version 6.2
9 unmodified lines
237(bugfix release, released on November 27th 2015)238239- Resolved an issue with invisible progress bars no longer rendering.240- Disable chain commands with subcommands as they were inherently broken.265- Fix `MissingParameter` not working without parameters passed.241- Fix ``MissingParameter`` not working without parameters passed.242243Version 6.0244-----------245246(codename "pow pow", released on November 24th 2015)247248- Optimized the progressbar rendering to not render when it did not249 actually change.274- Explicitly disallow nargs=-1 with a set default.250- Explicitly disallow ``nargs=-1`` with a set default.251- The context is now closed before it's popped from the stack.252- Added support for short aliases for the false flag on toggles.253- Click will now attempt to aid you with debugging locale errors254 better by listing with the help of the OS what locales are
3 unmodified lines
258 now.259- For Windows users on Python 2, Click will now handle Unicode more260 correctly handle Unicode coming in from the system. This also has261 the disappointing side effect that filenames will now be always286 unicode by default in the `Path` type which means that this can262 unicode by default in the ``Path`` type which means that this can263 introduce small bugs for code not aware of this.288- Added a `type` parameter to `Path` to force a specific string type264- Added a ``type`` parameter to ``Path`` to force a specific string type265 on the value.290- For users running Python on Windows the `echo`) and `prompt` functions266- For users running Python on Windows the ``echo`` and ``prompt`` functions267 now work with full unicode functionality in the Python windows console268 by emulating an output stream. This also applies to getting the293 virtual output and input streams via `click.get_text_stream(...)`.269 virtual output and input streams via ``click.get_text_stream(...)``.270- Unittests now always force a certain virtual terminal width.271- Added support for allowing dashes to indicate standard streams to the296 `Path` type.272 ``Path`` type.273- Multi commands in chain mode no longer propagate arguments left over274 from parsing to the callbacks. It's also now disallowed through an275 exception when optional arguments are attached to multi commands if chain276 mode is enabled.
7 unmodified lines
284-----------285286(bugfix release, released on 17th August 2015)287312- Fix a bug in `pass_obj` that would accidentally pass the context too.288- Fix a bug in ``pass_obj`` that would accidentally pass the context too.289290Version 5.0291-----------292293(codename "tok tok", released on 16th August 2015)294295- Removed various deprecated functionality.320- Atomic files now only accept the `w` mode.296- Atomic files now only accept the ``w`` mode.297- Change the usage part of help output for very long commands to wrap298 their arguments onto the next line, indented by 4 spaces.299- Fix a bug where return code and error messages were incorrect when300 using ``CliRunner``.325- added `get_current_context`.326- added a `meta` dictionary to the context which is shared across the301- added ``get_current_context``.302- added a ``meta`` dictionary to the context which is shared across the303 linked list of contexts to allow click utilities to place state there.328- introduced `Context.scope`.329- The `echo` function is now threadsafe: It calls the `write` method of the304- introduced ``Context.scope``.305- The ``echo`` function is now threadsafe: It calls the ``write`` method of the306 underlying object only once.331- `prompt(hide_input=True)` now prints a newline on `^C`.307- ``prompt(hide_input=True)`` now prints a newline on ``^C``.308- Click will now warn if users are using ``unicode_literals``.309- Click will now ignore the ``PAGER`` environment variable if it is empty or310 contains only whitespace.335- The `click-contrib` GitHub organization was created.311- The ``click-contrib`` GitHub organization was created.312313Version 4.1314-----------315316(bugfix release, released on July 14th 2015)317342- Fix a bug where error messages would include a trailing `None` string.318- Fix a bug where error messages would include a trailing ``None`` string.319- Fix a bug where Click would crash on docstrings with trailing newlines.344- Support streams with encoding set to `None` on Python 3 by barfing with320- Support streams with encoding set to ``None`` on Python 3 by barfing with321 a better error.322- Handle ^C in less-pager properly.347- Handle return value of `None` from `sys.getfilesystemencoding`348- Fix crash when writing to unicode files with `click.echo`.323- Handle return value of ``None`` from ``sys.getfilesystemencoding``324- Fix crash when writing to unicode files with ``click.echo``.325- Fix type inference with multiple options.326327Version 4.0328-----------329330(codename "zoom zoom", released on March 31st 2015)331356- Added `color` parameters to lots of interfaces that directly or indirectly332- Added ``color`` parameters to lots of interfaces that directly or indirectly333 call into echoing. This previously was always autodetection (with the358 exception of the `echo_via_pager` function). Now you can forcefully334 exception of the ``echo_via_pager`` function). Now you can forcefully335 enable or disable it, overriding the auto detection of Click.360- Added an `UNPROCESSED` type which does not perform any type changes which336- Added an ``UNPROCESSED`` type which does not perform any type changes which337 simplifies text handling on 2.x / 3.x in some special advanced usecases.362- Added `NoSuchOption` and `BadOptionUsage` exceptions for more generic338- Added ``NoSuchOption`` and ``BadOptionUsage`` exceptions for more generic339 handling of errors.340- Added support for handling of unprocessed options which can be useful in341 situations where arguments are forwarded to underlying tools.366- Added `max_content_width` parameter to the context which can be used to342- Added ``max_content_width`` parameter to the context which can be used to343 change the maximum width of help output. By default Click will not format344 content for more than 80 characters width.345- Added support for writing prompts to stderr.346- Fix a bug when showing the default for multiple arguments.371- Added support for custom subclasses to `option` and `argument`.347- Added support for custom subclasses to ``option`` and ``argument``.348- Fix bug in ``clear()`` on Windows when colorama is installed.349- Reject ``nargs=-1`` for options properly. Options cannot be variadic.350- Fixed an issue with bash completion not working properly for commands with351 non ASCII characters or dashes.
15 unmodified lines
367-----------368369(bugfix release, released on August 22nd 2014)370395- Added missing `err` parameter forwarding to the `secho` function.371- Added missing ``err`` parameter forwarding to the ``secho`` function.372- Fixed default parameters not being handled properly by the context373 invoke method. This is a backwards incompatible change if the function374 was used improperly. See :ref:`upgrade-to-3.2` for more information.375- Removed the `invoked_subcommands` attribute largely. It is not possible
30 unmodified lines
406 passing. This should catch situations where users wanted to407 created arguments instead of options.408- Restructured Click internally to support vendoring.409- Added support for multi command chaining.434- Added support for defaults on options with `multiple` and435 options and arguments with `nargs != 1`.436- label passed to `progressbar` is no longer rendered with410- Added support for defaults on options with ``multiple`` and411 options and arguments with ``nargs != 1``.412- label passed to ``progressbar`` is no longer rendered with413 whitespace stripped.438- added a way to disable the standalone mode of the `main`414- added a way to disable the standalone mode of the ``main``415 method on a Click command to be able to handle errors better.416- added support for returning values from command callbacks.441- added simplifications for printing to stderr from `echo`.417- added simplifications for printing to stderr from ``echo``.418- added result callbacks for groups.419- entering a context multiple times defers the cleanup until420 the last exit occurs.445- added `open_file`.421- added ``open_file``.422423Version 2.6424-----------425
20 unmodified lines
446-----------447448(bugfix release, released on July 3rd 2014)449474- Fixed an incorrectly formatted help record for count options.'450- Fixed an incorrectly formatted help record for count options.451- Add support for ansi code stripping on Windows if colorama452 is not available.453- restored the Click 1.0 handling of the help parameter for certain454 edge cases.
37 unmodified lines
492- added :func:`progressbar`; a function to show progress bars.493- added :func:`get_app_dir`; a function to calculate the home folder494 for configs.495- Added transparent handling for ANSI codes into the :func:`echo`520 function through `colorama`.496 function through ``colorama``.497- Added :func:`clear` function.498- Breaking change: parameter callbacks now get the parameter object499 passed as second argument. There is legacy support for old callbacks500 which will warn but still execute the script.
36 unmodified lines
modified:README.rst+22 added-22 removed
1\$ click\_2==========34What's Click?5-------------64Click is a Python package for creating beautiful command line interfaces5in a composable way with as little code as necessary. It's the "Command6Line Interface Creation Kit". It's highly configurable but comes with7sensible defaults out of the box.89It aims to make the process of writing command line tools quick and fun13while also preventing any frustration caused by the inability to implement14an intended CLI API.10while also preventing any frustration caused by the inability to11implement an intended CLI API.1213Click in three points:17 - arbitrary nesting of commands18 - automatic help page generation19 - supports lazy loading of subcommands at runtime1415- arbitrary nesting of commands16- automatic help page generation17- supports lazy loading of subcommands at runtime181920Installing21----------2223Install and update using `pip`_:
1 unmodified line
25.. code-block:: text2627 $ pip install click2831Click supports Python 3.4 and newer, Python 2.7, and PyPy29Click supports Python 3.4 and newer, Python 2.7, and PyPy.3031.. _pip: https://pip.pypa.io/en/stable/quickstart/323334A Simple Example35----------------3637What does it look like? Here is an example of a simple Click program:
23 unmodified lines
61 Hello John!62 Hello John!63 Hello John!646566Donate67------6869The Pallets organization develops and supports Flask and the libraries70it uses. In order to grow the community of contributors and users, and71allow the maintainers to devote more time to the projects, `please72donate today`_.7372.. _please donate today: https://psfmember.org/civicrm/contribute/transact?reset=1&id=2074.. _please donate today: https://palletsprojects.com/donate757677Links78-----7978* Website: https://www.palletsprojects.com/p/click/79* Documentation: http://click.pocoo.org/80* License: `BSD <https://github.com/pallets/click/blob/master/LICENSE>`_81* Releases: https://pypi.org/project/click/82* Code: https://github.com/pallets/click83* Issue tracker: https://github.com/pallets/click/issues84* Test status:80* Website: https://palletsprojects.com/p/click/81* Documentation: https://click.palletsprojects.com/82* License: `BSD <https://github.com/pallets/click/blob/master/LICENSE>`_83* Releases: https://pypi.org/project/click/84* Code: https://github.com/pallets/click85* Issue tracker: https://github.com/pallets/click/issues86* Test status:8786 * Linux, Mac: https://travis-ci.org/pallets/click87 * Windows: https://ci.appveyor.com/project/pallets/click88 * Linux, Mac: https://travis-ci.org/pallets/click89 * Windows: https://ci.appveyor.com/project/pallets/click9089* Test coverage: https://codecov.io/gh/pallets/click9091.. _pip: https://pip.pypa.io/en/stable/quickstart/91* Test coverage: https://codecov.io/gh/pallets/click
modified:setup.py+4 added-2 removed
15 unmodified lines
1617setup(18 name='click',19 version=version,20 url='https://www.palletsprojects.com/p/click/',20 url='https://palletsprojects.com/p/click/',21 author='Armin Ronacher',22 author_email='armin.ronacher@active-4.com',23 maintainer='Pallets team',24 maintainer_email='contact@palletsprojects.com',
10 unmodified lines
35 'sphinx',36 ],37 'docs': [38 'sphinx',39 'Pallets-Sphinx-Themes',40 ]41 },42 classifiers=[43 'Development Status :: 5 - Production/Stable',44 'Intended Audience :: Developers',45 'License :: OSI Approved :: BSD License',45 'Operating System :: OS Independent'46 'Operating System :: OS Independent',47 'Programming Language :: Python',48 'Programming Language :: Python :: 2',49 'Programming Language :: Python :: 2.7',50 'Programming Language :: Python :: 3',51 'Programming Language :: Python :: 3.4',52 'Programming Language :: Python :: 3.5',53 'Programming Language :: Python :: 3.6',54 'Programming Language :: Python :: 3.7',55 ],56 python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",57)