Skip to content

Custom Keyer Adding To KeyRing

Leo Loobeek edited this page Oct 5, 2018 · 1 revision

If you want to add to KeyRing, hopefully it isn't too painful. Custom keyer functions allow for you to quickly and easily add custom keyers, so if that meets what your goal is head over here.

The value of adding a keyer function to KeyRing is you can stockpile all the great keying techniques you and your team use and even contribute back to this project. The world is your oyster!

Setting up the XML

To get an idea on how to add a keyer function to the project take a look at any and all the XML files within the supported languages (data/<lang>/keyers). You will need to address the following in your XML file:

  • title
  • description
  • type - chain or combo
  • inputnum - how many inputs to your function
  • inputhelp - a brief writeup on what your inputs are, if contributing here you need to use the same format as the other keyers which describes the input number, each input, and an example.
  • function - this is the meat of your keyer function
  • caller - this is the code that adds to the combos or chains functions

Go Templates

I use the Go text/template package to read in these XML files and put together the final payload. You may need to use specific Go Template markup to include some inputs in the source code, for example adding USERNAME into the environmental variable keyer caller.

Basically you will need to use this to access the first input you have:

{{index .Inputs 0}}

And if you had a second or third, etc..;

{{index .Inputs 1}}
{{index .Inputs 2}}

XML Caveat

The upside of using an XML file for this is the ease and simplicity of putting it together, and it also is a markup language that supports

Clone this wiki locally