forked from platformio/platformio-core
Initial support of PlatformIO Project Generator // Issue #151
This commit is contained in:
@@ -8,6 +8,7 @@ from shutil import copyfile
|
||||
import click
|
||||
|
||||
from platformio import app, exception
|
||||
from platformio.ide.projectgenerator import ProjectGenerator
|
||||
from platformio.util import get_boards, get_source_dir
|
||||
|
||||
|
||||
@@ -28,9 +29,11 @@ def validate_boards(ctx, param, value): # pylint: disable=W0613
|
||||
writable=True, resolve_path=True))
|
||||
@click.option("--board", "-b", multiple=True, metavar="TYPE",
|
||||
callback=validate_boards)
|
||||
@click.option("--ide",
|
||||
type=click.Choice(ProjectGenerator.get_supported_ides()))
|
||||
@click.option("--disable-auto-uploading", is_flag=True)
|
||||
@click.option("--env-prefix", default="autogen_")
|
||||
def cli(project_dir, board, disable_auto_uploading, env_prefix):
|
||||
def cli(project_dir, board, ide, disable_auto_uploading, env_prefix):
|
||||
|
||||
# ask about auto-uploading
|
||||
if board and app.get_setting("enable_prompts"):
|
||||
@@ -82,6 +85,10 @@ def cli(project_dir, board, disable_auto_uploading, env_prefix):
|
||||
fill_project_envs(
|
||||
project_file, board, disable_auto_uploading, env_prefix)
|
||||
|
||||
if ide:
|
||||
pg = ProjectGenerator(project_dir, ide)
|
||||
pg.generate()
|
||||
|
||||
click.secho(
|
||||
"\nProject has been successfully initialized!\nUseful commands:\n"
|
||||
"`platformio run` - process/build project from the current "
|
||||
|
Reference in New Issue
Block a user