mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
Merge branch 'feature/idfpy_envvar_help' into 'master'
idf.py: Add help for all options with environment variables See merge request espressif/esp-idf!9356
This commit is contained in:
@@ -144,7 +144,6 @@ def init_cli(verbose_output=None):
|
|||||||
|
|
||||||
class Deprecation(object):
|
class Deprecation(object):
|
||||||
"""Construct deprecation notice for help messages"""
|
"""Construct deprecation notice for help messages"""
|
||||||
|
|
||||||
def __init__(self, deprecated=False):
|
def __init__(self, deprecated=False):
|
||||||
self.deprecated = deprecated
|
self.deprecated = deprecated
|
||||||
self.since = None
|
self.since = None
|
||||||
@@ -292,7 +291,6 @@ def init_cli(verbose_output=None):
|
|||||||
|
|
||||||
names - alias of 'param_decls'
|
names - alias of 'param_decls'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
names = kwargs.pop("names")
|
names = kwargs.pop("names")
|
||||||
super(Argument, self).__init__(names, **kwargs)
|
super(Argument, self).__init__(names, **kwargs)
|
||||||
@@ -331,7 +329,6 @@ def init_cli(verbose_output=None):
|
|||||||
|
|
||||||
class Option(click.Option):
|
class Option(click.Option):
|
||||||
"""Option that knows whether it should be global"""
|
"""Option that knows whether it should be global"""
|
||||||
|
|
||||||
def __init__(self, scope=None, deprecated=False, hidden=False, **kwargs):
|
def __init__(self, scope=None, deprecated=False, hidden=False, **kwargs):
|
||||||
"""
|
"""
|
||||||
Keyword arguments additional to Click's Option class:
|
Keyword arguments additional to Click's Option class:
|
||||||
@@ -355,6 +352,9 @@ def init_cli(verbose_output=None):
|
|||||||
deprecation = Deprecation(deprecated)
|
deprecation = Deprecation(deprecated)
|
||||||
self.help = deprecation.help(self.help)
|
self.help = deprecation.help(self.help)
|
||||||
|
|
||||||
|
if self.envvar:
|
||||||
|
self.help += " The default value can be set with the %s environment variable." % self.envvar
|
||||||
|
|
||||||
if self.scope.is_global:
|
if self.scope.is_global:
|
||||||
self.help += " This option can be used at most once either globally, or for one subcommand."
|
self.help += " This option can be used at most once either globally, or for one subcommand."
|
||||||
|
|
||||||
@@ -367,7 +367,6 @@ def init_cli(verbose_output=None):
|
|||||||
|
|
||||||
class CLI(click.MultiCommand):
|
class CLI(click.MultiCommand):
|
||||||
"""Action list contains all actions with options available for CLI"""
|
"""Action list contains all actions with options available for CLI"""
|
||||||
|
|
||||||
def __init__(self, all_actions=None, verbose_output=None, help=None):
|
def __init__(self, all_actions=None, verbose_output=None, help=None):
|
||||||
super(CLI, self).__init__(
|
super(CLI, self).__init__(
|
||||||
chain=True,
|
chain=True,
|
||||||
|
@@ -194,14 +194,14 @@ def action_extensions(base_actions, project_path):
|
|||||||
"help": "Show IDF version and exit.",
|
"help": "Show IDF version and exit.",
|
||||||
"is_flag": True,
|
"is_flag": True,
|
||||||
"expose_value": False,
|
"expose_value": False,
|
||||||
"callback": idf_version_callback
|
"callback": idf_version_callback,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"names": ["--list-targets"],
|
"names": ["--list-targets"],
|
||||||
"help": "Print list of supported targets and exit.",
|
"help": "Print list of supported targets and exit.",
|
||||||
"is_flag": True,
|
"is_flag": True,
|
||||||
"expose_value": False,
|
"expose_value": False,
|
||||||
"callback": list_targets_callback
|
"callback": list_targets_callback,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"names": ["-C", "--project-dir"],
|
"names": ["-C", "--project-dir"],
|
||||||
@@ -227,7 +227,7 @@ def action_extensions(base_actions, project_path):
|
|||||||
"is_flag": True,
|
"is_flag": True,
|
||||||
"is_eager": True,
|
"is_eager": True,
|
||||||
"default": False,
|
"default": False,
|
||||||
"callback": verbose_callback
|
"callback": verbose_callback,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"names": ["--preview"],
|
"names": ["--preview"],
|
||||||
@@ -237,11 +237,10 @@ def action_extensions(base_actions, project_path):
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"names": ["--ccache/--no-ccache"],
|
"names": ["--ccache/--no-ccache"],
|
||||||
"help": (
|
"help": "Use ccache in build. Disabled by default.",
|
||||||
"Use ccache in build. Disabled by default, unless "
|
|
||||||
"IDF_CCACHE_ENABLE environment variable is set to a non-zero value."),
|
|
||||||
"is_flag": True,
|
"is_flag": True,
|
||||||
"default": os.getenv("IDF_CCACHE_ENABLE") not in [None, "", "0"],
|
"envvar": "IDF_CCACHE_ENABLE",
|
||||||
|
"default": False,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"names": ["-G", "--generator"],
|
"names": ["-G", "--generator"],
|
||||||
@@ -253,7 +252,7 @@ def action_extensions(base_actions, project_path):
|
|||||||
"help": "Only process arguments, but don't execute actions.",
|
"help": "Only process arguments, but don't execute actions.",
|
||||||
"is_flag": True,
|
"is_flag": True,
|
||||||
"hidden": True,
|
"hidden": True,
|
||||||
"default": False
|
"default": False,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"global_action_callbacks": [validate_root_options],
|
"global_action_callbacks": [validate_root_options],
|
||||||
@@ -291,14 +290,15 @@ def action_extensions(base_actions, project_path):
|
|||||||
"names": ["--style", "--color-scheme", "style"],
|
"names": ["--style", "--color-scheme", "style"],
|
||||||
"help": (
|
"help": (
|
||||||
"Menuconfig style.\n"
|
"Menuconfig style.\n"
|
||||||
"Is it possible to customize the menuconfig style by either setting the MENUCONFIG_STYLE "
|
"The built-in styles include:\n\n"
|
||||||
"environment variable or through this option. The built-in styles include:\n\n"
|
|
||||||
"- default - a yellowish theme,\n\n"
|
"- default - a yellowish theme,\n\n"
|
||||||
"- monochrome - a black and white theme, or\n"
|
"- monochrome - a black and white theme, or\n\n"
|
||||||
"- aquatic - a blue theme.\n\n"
|
"- aquatic - a blue theme.\n\n"
|
||||||
"The default value is \"aquatic\". It is possible to customize these themes further "
|
"It is possible to customize these themes further"
|
||||||
"as it is described in the Color schemes section of the kconfiglib documentation."),
|
" as it is described in the Color schemes section of the kconfiglib documentation.\n"
|
||||||
"default": os.environ.get('MENUCONFIG_STYLE', 'aquatic'),
|
'The default value is \"aquatic\".'),
|
||||||
|
"envvar": "MENUCONFIG_STYLE",
|
||||||
|
"default": "aquatic",
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@@ -134,7 +134,7 @@ def action_extensions(base_actions, project_path):
|
|||||||
|
|
||||||
baud_rate = {
|
baud_rate = {
|
||||||
"names": ["-b", "--baud"],
|
"names": ["-b", "--baud"],
|
||||||
"help": "Baud rate for flashing. The default value can be set with the ESPBAUD environment variable.",
|
"help": "Baud rate for flashing.",
|
||||||
"scope": "global",
|
"scope": "global",
|
||||||
"envvar": "ESPBAUD",
|
"envvar": "ESPBAUD",
|
||||||
"default": 460800,
|
"default": 460800,
|
||||||
@@ -142,7 +142,7 @@ def action_extensions(base_actions, project_path):
|
|||||||
|
|
||||||
port = {
|
port = {
|
||||||
"names": ["-p", "--port"],
|
"names": ["-p", "--port"],
|
||||||
"help": "Serial port. The default value can be set with the ESPPORT environment variable.",
|
"help": "Serial port.",
|
||||||
"scope": "global",
|
"scope": "global",
|
||||||
"envvar": "ESPPORT",
|
"envvar": "ESPPORT",
|
||||||
"default": None,
|
"default": None,
|
||||||
|
Reference in New Issue
Block a user