tools: Add docs subcommand docs which opens browser with documentation for current version of idf and model of your target

Add docs subcommand with options:
--no-browser - Prints url for current documentation instead of opens browser with documentation
--language - Select documentation language
--starting-page - Choice section of documentation to open
--version - Choice version of esp-idf
--target - Choice model of your target
This commit is contained in:
Simon
2021-06-03 17:14:38 +02:00
committed by simon.chupin
parent 8887897f54
commit 0b9afa509f
5 changed files with 98 additions and 10 deletions

View File

@@ -47,6 +47,11 @@ def _idf_version_from_cmake():
return None
def get_target(path, sdkconfig_filename='sdkconfig'):
path = os.path.join(path, sdkconfig_filename)
return get_sdkconfig_value(path, 'CONFIG_IDF_TARGET')
def idf_version():
"""Print version of ESP-IDF"""
@@ -277,7 +282,7 @@ def is_target_supported(project_path, supported_targets):
"""
Returns True if the active target is supported, or False otherwise.
"""
return get_sdkconfig_value(os.path.join(project_path, 'sdkconfig'), 'CONFIG_IDF_TARGET') in supported_targets
return get_target(project_path) in supported_targets
def _guess_or_check_idf_target(args, prog_name, cache):
@@ -290,12 +295,9 @@ def _guess_or_check_idf_target(args, prog_name, cache):
"""
# Default locations of sdkconfig files.
# FIXME: they may be overridden in the project or by a CMake variable (IDF-1369).
sdkconfig_path = os.path.join(args.project_dir, 'sdkconfig')
sdkconfig_defaults_path = os.path.join(args.project_dir, 'sdkconfig.defaults')
# These are used to guess the target from sdkconfig, or set the default target by sdkconfig.defaults.
idf_target_from_sdkconfig = get_sdkconfig_value(sdkconfig_path, 'CONFIG_IDF_TARGET')
idf_target_from_sdkconfig_defaults = get_sdkconfig_value(sdkconfig_defaults_path, 'CONFIG_IDF_TARGET')
idf_target_from_sdkconfig = get_target(args.project_dir)
idf_target_from_sdkconfig_defaults = get_target(args.project_dir, 'sdkconfig.defaults')
idf_target_from_env = os.environ.get('IDF_TARGET')
idf_target_from_cache = cache.get('IDF_TARGET')