Remove prompt with "auto-uploading" from init command and add --enable-auto-uploading option // Resolve #352

This commit is contained in:
Ivan Kravets
2015-12-03 17:19:43 +02:00
parent 5b1ceccd1f
commit 5dc1396f05
4 changed files with 18 additions and 24 deletions

View File

@ -4,6 +4,13 @@ Release History
PlatformIO 2.0
--------------
2.4.2 (2015-12-??)
~~~~~~~~~~~~~~~~~~
* Removed prompt with "auto-uploading" from `platformio init <http://docs.platformio.org/en/latest/userguide/cmd_init.html>`__
command and added ``--enable-auto-uploading`` option
(`issue #352 <https://github.com/platformio/platformio/issues/352>`_)
2.4.1 (2015-12-01)
~~~~~~~~~~~~~~~~~~

View File

@ -74,12 +74,11 @@ A list with supported IDE is available within ``platformio init --help`` command
Also, please look into :ref:`ide` page.
.. option::
--disable-auto-uploading
--enable-auto-uploading
If you initialise project with the specified
:option:`platformio init --board`, then *PlatformIO*
will create environment with enabled firmware auto-uploading. This option
allows you to disable firmware auto-uploading by default.
will create environment with enabled firmware auto-uploading.
.. option::
--env-prefix
@ -138,9 +137,6 @@ 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.

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
VERSION = (2, 4, 1)
VERSION = (2, 4, "2.dev0")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@ -45,21 +45,11 @@ def validate_boards(ctx, param, value): # pylint: disable=W0613
callback=validate_boards)
@click.option("--ide",
type=click.Choice(ProjectGenerator.get_supported_ides()))
@click.option("--disable-auto-uploading", is_flag=True)
@click.option("--enable-auto-uploading", is_flag=True)
@click.option("--env-prefix", default="")
@click.pass_context
def cli(ctx, project_dir, board, ide, # pylint: disable=R0913
disable_auto_uploading, env_prefix):
# ask about auto-uploading
if board and app.get_setting("enable_prompts"):
disable_auto_uploading = not click.confirm(
"Would 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."
)
click.echo("")
enable_auto_uploading, env_prefix):
if project_dir == getcwd():
click.secho("\nThe current working directory", fg="yellow", nl=False)
@ -141,7 +131,7 @@ http://docs.platformio.org/en/latest/projectconf.html#lib-install
if board:
fill_project_envs(
ctx, project_file, board, disable_auto_uploading, env_prefix)
ctx, project_file, board, enable_auto_uploading, env_prefix)
if ide:
pg = ProjectGenerator(project_dir, ide, board[0] if board else None)
@ -154,12 +144,13 @@ http://docs.platformio.org/en/latest/projectconf.html#lib-install
"`platformio run --target upload` or `platformio run -t upload` "
"- upload firmware to embedded board\n"
"`platformio run --target clean` - clean project (remove compiled "
"files)",
"files)\n"
"`platformio run --help` - additional information",
fg="green"
)
def fill_project_envs(ctx, project_file, board_types, disable_auto_uploading,
def fill_project_envs(ctx, project_file, board_types, enable_auto_uploading,
env_prefix):
builtin_boards = get_boards()
content = []
@ -188,8 +179,8 @@ def fill_project_envs(ctx, project_file, board_types, disable_auto_uploading,
content.append("framework = %s" % frameworks[0])
content.append("board = %s" % type_)
content.append("%stargets = upload" % ("# " if disable_auto_uploading
else ""))
if enable_auto_uploading:
content.append("targets = upload")
_install_dependent_platforms(ctx, used_platforms)