Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
5 changes: 2 additions & 3 deletions pros/cli/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,12 @@ def wrapper(f: Union[click.Command, Callable]):
def shadow_command(command: click.Command):
def wrapper(f: Union[click.Command, Callable]):
if isinstance(f, click.Command):
f.params.extend(p for p in command.params if p.name not in [p.name for p in command.params])
f.params.extend(p for p in command.params if p.name not in [p.name for p in f.params])
else:
if not hasattr(f, '__click_params__'):
f.__click_params__ = []
f.__click_params__.extend(p for p in command.params if p.name not in [p.name for p in f.__click_params__])
f.__click_params__.extend(p for p in command.params[::-1] if p.name not in [p.name for p in f.__click_params__])
return f

return wrapper


Expand Down
11 changes: 6 additions & 5 deletions pros/cli/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def upload(path: Optional[str], project: Optional[c.Project], port: str, **kwarg
if kwargs['remote_name'] is None:
kwargs['remote_name'] = os.path.splitext(os.path.basename(path))[0]
kwargs['remote_name'] = kwargs['remote_name'].replace('@', '_')
kwargs['slot'] = kwargs['slot'] or 1
kwargs['slot'] -= 1

action_to_kwarg = {
Expand Down Expand Up @@ -146,11 +147,11 @@ def upload(path: Optional[str], project: Optional[c.Project], port: str, **kwarg
device = vex.V5Device(ser)
elif kwargs['target'] == 'cortex':
device = vex.CortexDevice(ser).get_connected_device()
if project is not None:
device.upload_project(project, **kwargs)
else:
if os.path.isfile(path):
with click.open_file(path, mode='rb') as pf:
device.write_program(pf, **kwargs)
else:
device.upload_project(project, **kwargs)
except Exception as e:
logger(__name__).exception(e, exc_info=True)
exit(1)
Expand Down Expand Up @@ -201,8 +202,8 @@ def __str__(self):
@upload_cli.command('upload-terminal', aliases=['ut'], hidden=True)
@shadow_command(upload)
@click.pass_context
def make_upload_terminal(ctx, **upload_kwargs):
def upload_terminal(ctx, **upload_kwargs):
analytics.send("upload-terminal")
from .terminal import terminal
ctx.invoke(upload, **upload_kwargs)
ctx.invoke(terminal, request_banner=False)
ctx.invoke(terminal, request_banner=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add newline here