Ask about "auto-uploading" within "platformio init" command

This commit is contained in:
Ivan Kravets
2015-01-31 22:42:52 +02:00
parent 977f30d617
commit 673c484fa7
4 changed files with 61 additions and 24 deletions

View File

@ -19,17 +19,23 @@ Quickstart
$ platformio init --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
Would you like to enable firmware auto-uploading when project is successfully built using `platformio run` command?
Don't forget that you can upload firmware manually using `platformio run --target upload` command. [y/N]: y
The current working directory *** will be used for the new project.
You can specify another project directory via
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.
The next files/directories will be created in ***
`platformio.ini` - Project Configuration File
`src` - a source directory. Put your source code here
`lib` - a directory for the project specific libraries
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here
lib - Put here project specific or 3-rd party libraries
Do you want to continue? [y/N]: y
Project has been successfully initialized!
Now you can process it with `platformio run` command.
Useful commands:
`platformio run` - process/build project from the current directory
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files)
Put your source code ``*.h, *.c, *.cpp or *.ino`` files to ``src`` directory.

View File

@ -68,12 +68,15 @@ Examples
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.
The next files/directories will be created in ***
platformio.ini - Project Configuration File
src - a source directory. Put your source code here
lib - a directory for the project specific libraries
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here
lib - Put here project specific or 3-rd party libraries
Do you want to continue? [y/N]: y
Project has been successfully initialized!
Now you can process it with `platformio run` command.
Useful commands:
`platformio run` - process/build project from the current directory
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files)
2. Create new project in the specified directory
@ -83,12 +86,15 @@ Examples
$ platformio init -d %PATH_TO_DIR%
The next files/directories will be created in ***
platformio.ini - Project Configuration File
src - a source directory. Put your source code here
lib - a directory for the project specific libraries
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here
lib - Put here project specific or 3-rd party libraries
Do you want to continue? [y/N]: y
Project has been successfully initialized!
Now you can process it with `platformio run` command.
Useful commands:
`platformio run` - process/build project from the current directory
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files)
3. Initialise project for Arduino Uno
@ -96,10 +102,20 @@ Examples
$ platformio init --board uno
Would you like to enable firmware auto-uploading when project is successfully built using `platformio run` command?
Don't forget that you can upload firmware manually using `platformio run --target upload` command. [y/N]: y
The current working directory *** will be used for the new project.
You can specify another project directory via
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.
The next files/directories will be created in ***
platformio.ini - Project Configuration File
src - a source directory. Put your source code here
lib - a directory for the project specific libraries
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here
lib - Put here project specific or 3-rd party libraries
Do you want to continue? [y/N]: y
Project has been successfully initialized!
Now you can process it with `platformio run` command.
Useful commands:
`platformio run` - process/build project from the current directory
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files)

View File

@ -190,8 +190,8 @@ if is_uptarget:
break
if "UPLOAD_PORT" not in env:
Exit("Please specify environment 'upload_port' or use global "
"--upload-port option.")
print("WARNING!!! Please specify environment 'upload_port' or use "
"global --upload-port option.\n")
#
# Setup default targets

View File

@ -30,8 +30,17 @@ def cli(project_dir, board, disable_auto_uploading):
if board and not set(board).issubset(builtin_boards):
raise UnknownBoard(", ".join(set(board).difference(builtin_boards)))
# ask about auto-uploading
if board and app.get_setting("enable_prompts"):
disable_auto_uploading = not click.confirm(
"\nWould you like to enable firmware auto-uploading when project "
"is successfully built using `platformio run` command? \n"
"Don't forget that you can upload firmware manually using "
"`platformio run --target upload` command."
)
if project_dir == getcwd():
click.secho("The current working directory", fg="yellow", nl=False)
click.secho("\nThe current working directory", fg="yellow", nl=False)
click.secho(" %s " % project_dir, fg="cyan", nl=False)
click.secho(
"will be used for the new project.\n"
@ -42,15 +51,16 @@ def cli(project_dir, board, disable_auto_uploading):
click.echo("The next files/directories will be created in %s" %
click.style(project_dir, fg="cyan"))
click.echo("%s - Project Configuration File" %
click.echo("%s - Project Configuration File. |-> PLEASE EDIT ME <-|" %
click.style("platformio.ini", fg="cyan"))
click.echo("%s - a source directory. Put your source code here" %
click.echo("%s - Put your source code here" %
click.style("src", fg="cyan"))
click.echo("%s - a directory for the project specific libraries" %
click.echo("%s - Put here project specific or 3-rd party libraries" %
click.style("lib", fg="cyan"))
if (not app.get_setting("enable_prompts") or
click.confirm("Do you want to continue?")):
for d in (src_dir, lib_dir):
if not isdir(d):
makedirs(d)
@ -60,8 +70,13 @@ def cli(project_dir, board, disable_auto_uploading):
if board:
fill_project_envs(project_file, board, disable_auto_uploading)
click.secho(
"Project has been successfully initialized!\n"
"Now you can process it with `platformio run` command.",
"Project has been successfully initialized!\nUseful commands:\n"
"`platformio run` - process/build project from the current "
"directory\n"
"`platformio run --target upload` or `platformio run -t upload` "
"- upload firmware to embedded board\n"
"`platformio run --target clean` - clean project (remove compiled "
"files)",
fg="green"
)
else: