Skip to content

Commit 33d51a0

Browse files
committed
Add --force option to install command
1 parent 5f695a5 commit 33d51a0

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

pebble_tool/commands/install.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class InstallCommand(PebbleCommand):
2222
def __call__(self, args):
2323
super(InstallCommand, self).__call__(args)
2424
try:
25-
ToolAppInstaller(self.pebble, args.pbw).install()
25+
ToolAppInstaller(self.pebble, args.pbw).install(force_install=args.force)
2626
except IOError as e:
2727
if args.pbw is None:
2828
raise ToolError("You must either run this command from a project directory or specify the pbw "
@@ -65,6 +65,8 @@ def __call__(self, args):
6565
def add_parser(cls, parser):
6666
parser = super(InstallCommand, cls).add_parser(parser)
6767
parser.add_argument('pbw', help="Path to app to install.", nargs='?', default=None)
68+
parser.add_argument('--force', action="store_true",
69+
help="Force install even if the pbw doesn't support the connected platform")
6870
parser.add_argument('--logs', action="store_true", help="Enable logs")
6971
parser.add_argument('--qemu_logs', action="store_true", help="Enable QEMU serial logs (emulator only)")
7072
return parser
@@ -78,18 +80,18 @@ def __init__(self, pebble, pbw=None, quiet=False):
7880
self.progress_bar = ProgressBar(widgets=[Percentage(), Bar(marker='=', left='[', right=']'), ' ',
7981
FileTransferSpeed(), ' ', Timer(format='%s')])
8082

81-
def install(self):
83+
def install(self, force_install=False):
8284
if isinstance(self.pebble.transport, WebsocketTransport):
8385
self._install_via_websocket(self.pebble, self.pbw)
8486
else:
85-
self._install_via_serial(self.pebble, self.pbw)
87+
self._install_via_serial(self.pebble, self.pbw, force_install=force_install)
8688

87-
def _install_via_serial(self, pebble, pbw):
89+
def _install_via_serial(self, pebble, pbw, force_install=False):
8890
installer = AppInstaller(pebble, pbw)
8991
self.progress_bar.maxval = installer.total_size
9092
self.progress_bar.start()
9193
installer.register_handler("progress", self._handle_pp_progress)
92-
installer.install()
94+
installer.install(force_install=force_install)
9395
self.progress_bar.finish()
9496

9597
def _handle_pp_progress(self, sent, total_sent, total_size):

0 commit comments

Comments
 (0)