Skip to content

Commit

Permalink
cli: allow passing of udid using PYMOBILEDEVICE3_UDID env var
Browse files Browse the repository at this point in the history
  • Loading branch information
doronz88 committed Dec 5, 2021
1 parent 701c96a commit 51c69b3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pymobiledevice3/cli/cli_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@ def set_verbosity(ctx, param, value):
coloredlogs.set_level(logging.INFO - (value * 10))


UDID_ENV_VAR = 'PYMOBILEDEVICE3_UDID'


class Command(click.Command):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.params[:0] = [
click.Option(('lockdown', '--udid'), callback=self.udid),
click.Option(('lockdown', '--udid'), envvar=UDID_ENV_VAR, callback=self.udid,
help=f'Device unique identifier. You may pass {UDID_ENV_VAR} environment variable to pass this'
f' option as well'),
click.Option(('verbosity', '-v', '--verbose'), count=True, callback=set_verbosity, expose_value=False),
]

Expand Down

0 comments on commit 51c69b3

Please sign in to comment.