logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

cli_configuration.md (4080B)


  1. # QMK CLI Configuration
  2. This document explains how `qmk config` works.
  3. # Introduction
  4. Configuration for the QMK CLI is a key/value system. Each key consists of a subcommand and an argument name separated by a period. This allows for a straightforward and direct translation between config keys and the arguments they set.
  5. ## Simple Example
  6. As an example let's look at the command `qmk compile --keyboard clueboard/66/rev4 --keymap default`.
  7. There are two command line arguments that could be read from configuration instead:
  8. * `compile.keyboard`
  9. * `compile.keymap`
  10. Let's set these now:
  11. ```
  12. $ qmk config compile.keyboard=clueboard/66/rev4 compile.keymap=default
  13. compile.keyboard: None -> clueboard/66/rev4
  14. compile.keymap: None -> default
  15. Ψ Wrote configuration to '/Users/example/Library/Application Support/qmk/qmk.ini'
  16. ```
  17. Now I can run `qmk compile` without specifying my keyboard and keymap each time.
  18. ## Setting User Defaults
  19. Sometimes you want to share a setting between multiple commands. For example, multiple commands take the argument `--keyboard`. Rather than setting this value for every command you can set a user value which will be used by any command that takes that argument.
  20. Example:
  21. ```
  22. $ qmk config user.keyboard=clueboard/66/rev4 user.keymap=default
  23. user.keyboard: None -> clueboard/66/rev4
  24. user.keymap: None -> default
  25. Ψ Wrote configuration to '/Users/example/Library/Application Support/qmk/qmk.ini'
  26. ```
  27. # CLI Documentation (`qmk config`)
  28. The `qmk config` command is used to interact with the underlying configuration. When run with no argument it shows the current configuration. When arguments are supplied they are assumed to be configuration tokens, which are strings containing no spaces with the following form:
  29. ```
  30. <subcommand|general|default>[.<key>][=<value>]
  31. ```
  32. ## Setting Configuration Values
  33. You can set configuration values by putting an equal sign (=) into your config key. The key must always be the full `<section>.<key>` form.
  34. Example:
  35. ```
  36. $ qmk config default.keymap=default
  37. default.keymap: None -> default
  38. Ψ Wrote configuration to '/Users/example/Library/Application Support/qmk/qmk.ini'
  39. ```
  40. ## Reading Configuration Values
  41. You can read configuration values for the entire configuration, a single key, or for an entire section. You can also specify multiple keys to display more than one value.
  42. ### Entire Configuration Example
  43. ```
  44. qmk config
  45. ```
  46. ### Whole Section Example
  47. ```
  48. qmk config compile
  49. ```
  50. ### Single Key Example
  51. ```
  52. qmk config compile.keyboard
  53. ```
  54. ### Multiple Keys Example
  55. ```
  56. qmk config user compile.keyboard compile.keymap
  57. ```
  58. ## Deleting Configuration Values
  59. You can delete a configuration value by setting it to the special string `None`.
  60. Example:
  61. ```
  62. $ qmk config default.keymap=None
  63. default.keymap: default -> None
  64. Ψ Wrote configuration to '/Users/example/Library/Application Support/qmk/qmk.ini'
  65. ```
  66. ## Multiple Operations
  67. You can combine multiple read and write operations into a single command. They will be executed and displayed in order:
  68. ```
  69. $ qmk config compile default.keymap=default compile.keymap=None
  70. compile.keymap=skully
  71. compile.keyboard=clueboard/66_hotswap/gen1
  72. default.keymap: None -> default
  73. compile.keymap: skully -> None
  74. Ψ Wrote configuration to '/Users/example/Library/Application Support/qmk/qmk.ini'
  75. ```
  76. # User Configuration Options
  77. | Key | Default Value | Description |
  78. |-----|---------------|-------------|
  79. | user.keyboard | None | The keyboard path (Example: `clueboard/66/rev4`) |
  80. | user.keymap | None | The keymap name (Example: `default`) |
  81. | user.name | None | The user's GitHub username. |
  82. # All Configuration Options
  83. | Key | Default Value | Description |
  84. |-----|---------------|-------------|
  85. | compile.keyboard | None | The keyboard path (Example: `clueboard/66/rev4`) |
  86. | compile.keymap | None | The keymap name (Example: `default`) |
  87. | hello.name | None | The name to greet when run. |
  88. | new_keyboard.keyboard | None | The keyboard path (Example: `clueboard/66/rev4`) |
  89. | new_keyboard.keymap | None | The keymap name (Example: `default`) |