Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template Function Plugins #3

Closed
natefinch opened this issue Sep 5, 2017 · 1 comment
Closed

Template Function Plugins #3

natefinch opened this issue Sep 5, 2017 · 1 comment

Comments

@natefinch
Copy link
Member

Since functions are a key part of making templates simpler to write, we want to add the ability for users of gnorm to implement their own functions to add to the template funcMap. The plugins are simple executables that are run by gnorm, which thus may be written in any language.

Template Function Plugins

Template function plugins are simple executables which implement the following conventions:

Listing available functions

  • When run with the --list flag, plugins should write a newline-delimited list of supported function names to stdout.
  • When run with a single argument, the argument is the function name being called. The arguments to the function are passed to the executable's stdin as a JSON encoded array.
  • On success, a plugin should print the json-encoded results to stdout and exit with an exit code of zero.
  • On failure (for example, if the arguments passed into the function are not valid for the function), the plugin should print an error to stderr and exit with an exit code of 1.
  • If more than one argument is passed to the executable (i.e. more than just the function name), or if it is passed a function name that is not supported, the plugin should print an error to stderr and exit with an exit code of 2.
  • If no arguments are passed to the executable, the executable should print some useful help message to stderr.
@natefinch natefinch added this to To Do in Near Term Todos Sep 5, 2017
@natefinch natefinch moved this from To Do to In Progress in Near Term Todos Sep 20, 2017
@gernest
Copy link
Contributor

gernest commented Oct 2, 2017

@natefinch this should be closed. I forgot to do it in commits.

@natefinch natefinch moved this from In Progress to Done in Near Term Todos Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants