Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e077319a16 | |||
| 5b0ba9a25d | |||
| bd4e9bf9cf | |||
| b2974b4219 | |||
| be0dd95e46 | |||
| 30031a8cd7 | |||
| 94adba52c6 | |||
| 38aefc9716 |
+1
-1
@@ -1,3 +1,3 @@
|
||||
"""A program to help you work with qmk_firmware."""
|
||||
|
||||
__version__ = '0.0.12'
|
||||
__version__ = '0.0.15'
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
"""CLI wrapper for running QMK commands.
|
||||
|
||||
This program can be run from anywhere, with or without a qmk_firmware checkout. It provides a small set of subcommands for working with QMK and otherwise dispatches to the `qmk_firmware/bin/qmk` script for the repo you are currently in, or your default repo if you are not currently in a qmk_firmware checkout.
|
||||
This program can be run from anywhere, with or without a qmk_firmware repository. If a qmk_firmware repository can be located we will use that to augment our available subcommands.
|
||||
|
||||
FIXME(skullydazed/anyone): --help shows underscores where we want dashes in subcommands (EG json_keymap instead of json-keymap)
|
||||
TODO(skullydazed/anyone): Need a way to filter some subcommands from --help (EG `qmk subcommands`)
|
||||
TODO(skullydazed/anyone): Need a way to filter some subcommands from --help (EG `qmk hello`)
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
@@ -61,20 +61,18 @@ def find_qmk_firmware():
|
||||
|
||||
|
||||
def main():
|
||||
"""Dispatch the CLI subcommand to the proper place.
|
||||
|
||||
We first check to see if the subcommand was provided by the global `qmk`. If it was we import that module and hand control over to the entrypoint.
|
||||
|
||||
All other subcommands are dispatched to the local `qmk`, either the one we are currently in or whatever the user's default qmk_firmware is.
|
||||
"""Setup the environment before dispatching to the entrypoint.
|
||||
"""
|
||||
# Environment setup
|
||||
qmk_firmware = find_qmk_firmware()
|
||||
os.environ['QMK_HOME'] = str(qmk_firmware)
|
||||
os.environ['ORIG_CWD'] = os.getcwd()
|
||||
|
||||
# Import the subcommand modules
|
||||
import qmk_cli.subcommands
|
||||
|
||||
if qmk_firmware.exists():
|
||||
os.chdir(str(qmk_firmware))
|
||||
sys.path.append(str(qmk_firmware / 'lib' / 'python'))
|
||||
import qmk.cli
|
||||
|
||||
|
||||
@@ -4,19 +4,22 @@ import os
|
||||
from pathlib import Path
|
||||
|
||||
from milc import cli
|
||||
from qmk_cli.git import clone
|
||||
from qmk_cli.git import clone as git_clone
|
||||
|
||||
default_repo = 'qmk_firmware'
|
||||
default_fork = 'qmk/' + default_repo
|
||||
default_branch = 'master'
|
||||
|
||||
|
||||
@cli.argument('--baseurl', default='https://github.com', help='The URL all git operations start from.')
|
||||
@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.argument('--baseurl', default='https://github.com', help='The URL all git operations start from (Default: https://github.com)')
|
||||
@cli.argument('-b', '--branch', default=default_branch, help='The branch to clone (Default: %s)' % default_branch)
|
||||
@cli.argument('destination', default=None, nargs='?', help='The directory to clone to (Default: Current Directory)')
|
||||
@cli.argument('fork', default=default_fork, nargs='?', help='The qmk_firmware fork to clone (Default: %s)' % default_fork)
|
||||
@cli.subcommand('Clone a qmk_firmware fork.')
|
||||
def clone(cli):
|
||||
if not cli.args.destination:
|
||||
cli.args.destination = os.path.join(os.environ['ORIG_CWD'], default_fork.split('/')[-1])
|
||||
|
||||
qmk_firmware = Path(cli.args.destination)
|
||||
git_url = '/'.join((cli.config.clone.baseurl, cli.args.fork))
|
||||
|
||||
@@ -24,5 +27,5 @@ def clone(cli):
|
||||
cli.log.error('Destination already exists: %s', cli.args.destination)
|
||||
exit(1)
|
||||
|
||||
success = clone(git_url, cli.args.destination, cli.config.clone.branch)
|
||||
success = git_clone(git_url, cli.args.destination, cli.config.clone.branch)
|
||||
exit(0 if success else 1)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Increment the verison number and release a new version of qmk_cli.
|
||||
#
|
||||
# Required packages: pip3 install bumpversion twine
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[bumpversion]
|
||||
current_version = 0.0.12
|
||||
current_version = 0.0.15
|
||||
commit = True
|
||||
tag = True
|
||||
tag_name = {new_version}
|
||||
|
||||
@@ -6,6 +6,8 @@ setup_cfg.read('setup.cfg')
|
||||
metadata = setup_cfg['metadata']
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open('README.md', encoding='utf-8') as readme_file:
|
||||
long_description=readme_file.read()
|
||||
setup(
|
||||
name=metadata['dist-name'],
|
||||
description='A program to help users work with QMK Firmware.',
|
||||
@@ -19,7 +21,7 @@ if __name__ == "__main__":
|
||||
author_email=metadata['author-email'],
|
||||
maintainer=metadata['author'],
|
||||
maintainer_email=metadata['author-email'],
|
||||
long_description=open('README.md').read(),
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
packages=find_packages(),
|
||||
py_modules = ['milc'],
|
||||
@@ -41,6 +43,7 @@ if __name__ == "__main__":
|
||||
#"milc", #FIXME(skullydazed): Included in the repo for now.
|
||||
"appdirs",
|
||||
"argcomplete",
|
||||
"colorama"
|
||||
"colorama",
|
||||
"hjson"
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user