forked from platformio/platformio-core
Merge branch 'develop' into feature/platformio-30
* develop: Remove debug info Add "Rebuild C/C++ Project Index" target to CLion and Eclipse IDEs Iterating the dictionary directly instead of calling .keys() Iterating the dictionary directly instead of calling .keys() Add example dynamic `build_flags` Add new articles Update examples
This commit is contained in:
@@ -89,6 +89,10 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913
|
||||
)
|
||||
|
||||
if ide:
|
||||
if not board:
|
||||
board = get_first_board(project_dir)
|
||||
if board:
|
||||
board = [board]
|
||||
if not board:
|
||||
raise exception.BoardNotDefined()
|
||||
if len(board) > 1:
|
||||
@@ -100,8 +104,7 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913
|
||||
"your list '%s'." % (board[0], ", ".join(board)),
|
||||
fg="yellow"
|
||||
)
|
||||
pg = ProjectGenerator(
|
||||
project_dir, ide, board[0])
|
||||
pg = ProjectGenerator(project_dir, ide, board[0])
|
||||
pg.generate()
|
||||
|
||||
click.secho(
|
||||
@@ -117,6 +120,17 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913
|
||||
)
|
||||
|
||||
|
||||
def get_first_board(project_dir):
|
||||
with util.cd(project_dir):
|
||||
config = util.get_project_config()
|
||||
for section in config.sections():
|
||||
if not section.startswith("env:"):
|
||||
continue
|
||||
elif config.has_option(section, "board"):
|
||||
return config.get(section, "board")
|
||||
return None
|
||||
|
||||
|
||||
def init_base_project(project_dir):
|
||||
platformio_ini = join(project_dir, "platformio.ini")
|
||||
if not isfile(platformio_ini):
|
||||
|
Reference in New Issue
Block a user