aboutsummaryrefslogtreecommitdiffstats
path: root/src/_qmk
diff options
context:
space:
mode:
authorund3rdg <und3rdg@gmail.com>2021-06-22 22:49:16 +0100
committerund3rdg <und3rdg@gmail.com>2021-06-28 07:29:25 +0100
commit50255278805acb601a07d4d0b3cebfa00e91d1fa (patch)
tree9bfbb5e91a85694b46420410e8581f378dab99d2 /src/_qmk
parentMerge pull request #774 from simnalamburt/mssh-errorhandling (diff)
downloadzsh-completions-50255278805acb601a07d4d0b3cebfa00e91d1fa.tar
zsh-completions-50255278805acb601a07d4d0b3cebfa00e91d1fa.tar.gz
zsh-completions-50255278805acb601a07d4d0b3cebfa00e91d1fa.tar.bz2
zsh-completions-50255278805acb601a07d4d0b3cebfa00e91d1fa.tar.lz
zsh-completions-50255278805acb601a07d4d0b3cebfa00e91d1fa.tar.xz
zsh-completions-50255278805acb601a07d4d0b3cebfa00e91d1fa.tar.zst
zsh-completions-50255278805acb601a07d4d0b3cebfa00e91d1fa.zip
new completion for QMK CLI
Diffstat (limited to 'src/_qmk')
-rw-r--r--src/_qmk240
1 files changed, 240 insertions, 0 deletions
diff --git a/src/_qmk b/src/_qmk
new file mode 100644
index 0000000..2cfd659
--- /dev/null
+++ b/src/_qmk
@@ -0,0 +1,240 @@
+#compdef qmk
+# ------------------------------------------------------------------------------
+# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the zsh-users nor the
+# names of its contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# ------------------------------------------------------------------------------
+# Description
+# -----------
+#
+# Completion script for QMK CLI (https://beta.docs.qmk.fm/cli).
+# version: 0.0.48 (Jun 23 2021)
+#
+# ------------------------------------------------------------------------------
+# Authors
+# -------
+#
+# * precondition (https://github.com/precondition)
+# * undg (https://github.com/undg)
+#
+# ------------------------------------------------------------------------------
+
+
+_qmk_c2json(){
+ _arguments \
+ {-h,--help}"[show this help message and exit]" \
+ {-km,--keymap}"[KEYMAP The keymap's name]" \
+ {-kb,--keyboard}"[KEYBOARD The keyboard's name]" \
+ {-q,--quiet}"[Quiet mode, only output error messages]" \
+ {-o,--output}"[File to write to]:output_file:_files" \
+ "--no-cpp[Do not use 'cpp' on keymap.c]" \
+}
+
+_qmk_chibios-confmigrate(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-f,--force}"[Re-migrates an already migrated file, even if it doesn't detect a full ChibiOS config.]" \
+ {-d,--delete}"[If the file has no overrides, migration will delete the input file.]" \
+ {-o,--overwrite}"[Overwrites the input file during migration.]" \
+ {-r,--reference}"[REFERENCE Specify the reference file to compare against]" \
+ {-i,--input}"[INPUT Specify input config file.]" \
+}
+
+_qmk_clean(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-a,--all}"[Remove *.hex and *.bin files in the QMK root as well.]" \
+}
+
+_qmk_clone(){
+ _arguments \
+ {-h,--help}"[show this help message and exit]" \
+ {-km,--keymap}"[KEYMAP The keymap's name]" \
+ {-kb,--keyboard}"[KEYBOARD The keyboard's name]" \
+ {-q,--quiet}"[Quiet mode, only output error messages]" \
+ {-o,--output}"[File to write to]:output_file:_files" \
+ "--no-cpp[Do not use 'cpp' on keymap.c]"
+}
+
+_qmk_compile(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-n,--dry-run}"[Don't actually build, just show the make command to be run.]::_qmk_compile" \
+ {-km,--keymap}"[The keymap to build a firmware for. Ignored when a configurator export is supplied.]::_qmk_compile" \
+ {-kb,--keyboard}"[The keyboard to build a firmware for. Ignored when a configurator export is supplied.]::_qmk_compile" \
+ "*::configuratorExport:_files -g '*.json'" \
+}
+
+_qmk_config(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-ro,--read-only}"[Operate in read-only mode.]" \
+}
+
+_qmk_doctor(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-n,--no}"[Answer no to all questions.]" \
+ {-y,--yes}"[Answer yes to all questions.]" \
+}
+
+_qmk_env(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+}
+
+_qmk_flash(){
+ _arguments \
+ {-bl,--bootloader}"[The flash command, corresponding to qmk's make options of bootloaders.]::_qmk_flash" \
+ {-b,--bootloaders}"[List the available bootloaders.]::_qmk_flash" \
+ {-c,--clean}"[Remove object files before compiling]" \
+ {-n,--dry-run}"[Don't actually build, just show the make command to be run.]::_qmk_flash" \
+ {-e,--env}"[Set a variable to be passed to make. May be passed multiple times.]" \
+ {-h,--help}"[Print help text.]" \
+ {-kb,--keyboard}"[The keyboard to build a firmware for. Ignored when a configurator export is supplied.]::_qmk_flash" \
+ {-km,--keymap}"[The keymap to build a firmware for. Ignored when a configurator export is supplied.]::_qmk_flash" \
+ {-j,--parallel}"[Set the number of parallel make jobs to run.]" \
+ "*::configuratorExport:_files -g '*.json'" \
+}
+
+_qmk_generate-rgb-breathe-table(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-q,--quiet}"[Quiet mode, only output error messages]" \
+ {-o,--output}"[File to write to]:output_file:_files" \
+ {-m,--max}"[MAX The breathing maximum value, from 0 to 255. Default: 255]" \
+ {-c,--center}"[CENTER The breathing center value, from 1 to 2.7. Default: 1.85]" \
+}
+
+_qmk_info(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-f,--format}"[Format to display the data in (friendly, text, json)(Default: friendly).]: :(friendly text json)" \
+ {-m,--matrix}"[Render the layouts with matrix information.]" \
+ {-l,--layouts}"[Render the layouts.]" \
+ {-km,--keymap}"[Show the layers for a JSON keymap too.]" \
+ {-kb,--keyboard}"[Keyboard to show info for.]" \
+ "--ascii[Render layout box drawings in ASCII only.]" \
+}
+
+_qmk_json2c(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-q,--quiet}"[Quiet mode, only output error messages]" \
+ {-o,--output}"[File to write to]:output_file:_files" \
+ "*::configuratorExport:_files -g '*.json'"
+}
+
+_qmk_lint(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-km,--keymap}"[KEYMAP The keymap to check.]" \
+ {-kb,--keyboard}"[KEYBOARD The keyboard to check.]" \
+ "--strict[Treat warnings as errors.]" \
+}
+
+_qmk_list-keyboards(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+}
+
+_qmk_list-keymaps(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-kb,--keyboard}"[Specify keyboard name. Example: 1upkeyboards/1up60hse]::_qmk_new-keymap" \
+}
+
+_qmk_new-keymap(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-km,--keymap}"[Specify the name for the new keymap directory]::_qmk_new-keymap" \
+ {-kb,--keyboard}"[Specify keyboard name. Example: 1upkeyboards/1up60hse]::_qmk_new-keymap" \
+}
+
+_qmk_setup(){
+ _arguments \
+ {-h,--help}"[Print help text.]" \
+ {-H,--home}"[The location for QMK Firmware. Defaults to $HOME/qmk_firmware]" \
+ {-b,--branch}"[The branch to clone]" \
+ {-y,--yes}"[Answer yes to all questions.]" \
+ {-n,--no}"[Answer no to all questions.]" \
+ "--baseurl[The URL all git operations start from]" \
+}
+
+_qmk_command(){
+ local -a _qmk_cmds
+ _qmk_cmds=(
+ "c2json: Creates a keymap.json from a keymap.c file." \
+ "chibios-confmigrate: Generates a migrated ChibiOS configuration file, as a result of comparing the input against a reference" \
+ "clean: Clean the QMK firmware folder of build artifacts." \
+ "clone: Clone a qmk_firmware fork." \
+ "compile: Compile a QMK Firmware." \
+ "config: Read and write configuration settings." \
+ "doctor: Basic QMK environment checks" \
+ "env: Prints environment information." \
+ "flash: QMK Flash." \
+ "generate-rgb-breathe-table: Generates an RGB Light breathing table header." \
+ "info: Keyboard information." \
+ "json2c: Creates a keymap.c from a QMK Configurator export." \
+ "lint: Check keyboard and keymap for common mistakes." \
+ "list-keyboards: List the keyboards currently defined within QMK" \
+ "list-keymaps: List the keymaps for a specific keyboard" \
+ "new-keymap: Creates a new keymap for the keyboard of your choosing" \
+ "setup: Setup your computer for qmk_firmware." \
+ )
+
+ if ((CURRENT == 1)); then
+ _describe -t commands 'qmk commands' _qmk_cmds
+ else
+ local curcontext="$curcontext"
+ cmd="${${_qmk_cmds[(r)$words[1]:*]%%:*}}"
+ if (($#cmd)); then
+ if (( $+functions[_qmk_$cmd] )); then
+ _qmk_$cmd
+ else
+ _message "no options for $cmd"
+ fi
+ else
+ _message "no more options"
+ fi
+ fi
+}
+
+
+_arguments \
+ {-h,--help}"[Print help text.]" \
+ {-V,--version}"[Prints version information]" \
+ {-v,--verbose}"[Make the logging more verbose]" \
+ "--datetime-fmt[Format string for datetimes]:DATETIME_FMT:()" \
+ "--log-fmt[Format string for printed log output]:LOG_FMT:()" \
+ "--log-file-fmt[Format string for log file.]:LOG_FILE_FMT:()" \
+ "--log-file-level[Logging level for log file]:debug,info,warning,error,critical" \
+ "--log-file[File to write log messages to]:filename:_files" \
+ "--color[Enable color in output]" \
+ "--no-color[Disable color in output]" \
+ "--unicode[Enable unicode loglevels]" \
+ "--no-unicode[Disable unicode loglevels]" \
+ "--config-file[The location for the configuration file]:filename:_files" \
+ "*::qmk commands:_qmk_command" \
+