Aliases - advanced YAML usage for your users

Discussion in 'Resources' started by Zarius, Aug 24, 2011.

Thread Status:
Not open for further replies.
  1. Offline


    As I wrote up article for my plugin regarding alias usage and this applies to any YAML file in general I thought I'd share my findings here too.

    Here's the full tutorial with some examples of more advanced usage (and practical application to the OtherBlocks plugin).

    To summarise: aliases allow you to give a name to a chunk of data in any YAML file and use the alias name instead of retyping that data throughout the document. A simple example is below:

    aliases:  # just a dummy key for placing alias values however aliases can be defined anywhere
      - &myAliasName
        datakey: dataval
        moredata: morevals
      - *myAliasName  # this will be replaced with the two values from above as the plugin reads this config
    This may or may not be useful depending on the plugin/config file.

    Reference to aliases in the SnakeYAML documentation can be found here (aliases) and here (merges).

    This online YAML parser was very useful when testing aliases as it is "interactive" and shows you the results in realtime as you type.
    acuddlyheadcrab likes this.
Thread Status:
Not open for further replies.

Share This Page