mirror of
https://github.com/qmk/qmk_cli.git
synced 2026-08-04 16:27:12 -04:00
Rework how the CLI calls subcommands
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from qmk_cli.milc import cli
|
||||
from qmk.cli.git import clone
|
||||
from milc import cli
|
||||
from qmk_cli.git import clone
|
||||
|
||||
default_repo = 'qmk_firmware'
|
||||
default_fork = 'qmk/' + default_repo
|
||||
@@ -15,14 +15,14 @@ default_branch = 'master'
|
||||
@cli.argument('-b', '--branch', default=default_branch, help='The branch to clone.')
|
||||
@cli.argument('destination', default=os.environ['QMK_HOME'], nargs='?', help='The directory to clone to.')
|
||||
@cli.argument('fork', default=default_fork, nargs='?', help='The qmk_firmware fork to clone')
|
||||
@cli.entrypoint('Clone a qmk_firmware fork.')
|
||||
def main(cli):
|
||||
@cli.subcommand('Clone a qmk_firmware fork.')
|
||||
def clone(cli):
|
||||
qmk_firmware = Path(cli.args.destination)
|
||||
git_url = '/'.join((cli.config.general.baseurl, cli.args.fork))
|
||||
git_url = '/'.join((cli.config.clone.baseurl, cli.args.fork))
|
||||
|
||||
if qmk_firmware.exists():
|
||||
cli.log.error('Destination already exists: %s', cli.args.destination)
|
||||
exit(1)
|
||||
|
||||
success = clone(git_url, cli.args.destination, cli.config.general.branch)
|
||||
success = clone(git_url, cli.args.destination, cli.config.clone.branch)
|
||||
exit(0 if success else 1)
|
||||
|
||||
Reference in New Issue
Block a user