Improve handling of sys.args

This commit is contained in:
Ivan Kravets
2015-05-26 13:07:36 +03:00
parent 58f0f8fab4
commit 4d36db1319
2 changed files with 6 additions and 3 deletions

View File

@ -28,7 +28,9 @@ def on_platformio_start(ctx, force):
telemetry.on_command(ctx)
# skip any check operations when upgrade process
if len(sys.argv) > 1 and sys.argv[1] == "upgrade":
args = [str(s).lower() for s in sys.argv[1:]
if not str(s).startswith("-")]
if len(args) > 1 and args[1] == "upgrade":
return
after_upgrade(ctx)

View File

@ -4,9 +4,9 @@
import atexit
import platform
import re
import sys
import threading
import uuid
from sys import argv as sys_argv
from time import time
import click
@ -91,7 +91,8 @@ class MeasurementProtocol(TelemetryBase):
self['cd4'] = 1 if app.get_setting("enable_prompts") else 0
def _prefill_screen_name(self):
args = [str(s).lower() for s in sys_argv[1:]]
args = [str(s).lower() for s in sys.argv[1:]
if not str(s).startswith("-")]
if not args:
return