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

Provide a mechanism to list the available generators / templates #402

Open
4 tasks
ajbennieston opened this issue Apr 13, 2018 · 1 comment
Open
4 tasks
Assignees

Comments

@ajbennieston
Copy link
Member

ajbennieston commented Apr 13, 2018

It would be useful to be able to do something like python -m ffig --list-generators to obtain a list of the registered generators, templates and template aliases.

This would be useful in a number of situations, including

  • new users exploring the capabilities of FFIG.
  • the ffig-explorer REST API providing a way to query the generator names available.
  • developers who want to check that their generator or template has been properly detected by FFIG.

In order to support these use cases, in particular the REST API, the functionality to implement this should be exposed as a Python function in the ffig package, as well as via a command-line argument when FFIG is invoked as the main executable.

Some complications:

  • Not all templates represent complete binding generation; e.g. the support for Go bindings is split across two templates.
  • Some templates are used by a generator (Go, Python). As we move more logic into generators, the proportion of these will increase.
  • Some templates have aliases, e.g. ruby is an aliased generator for rb.tmpl.
  • Templates, and, in some cases, generators, don't always have very meaningful names. This suggests we should add a description field, at least for the generators, which can be set when a generator registers itself.

Sub-tasks

  • Add a description field for generator registration and to all existing generators (PR N402: Add descriptions to binding generators. #403).
  • Add a FFIG.py function to expose the list of generators & descriptions.
  • Add a --list-generators cmdline option.
  • Extend to support template files that are not registered as part of a generator or an alias.
ajbennieston added a commit that referenced this issue Apr 13, 2018
Generators now include a description for each binding they register.

These can be used to add a `--list-generators` feature.

This commit contains work for issue #402.
@ajbennieston
Copy link
Member Author

PR #403 includes support for descriptions for generators and a list function within the GeneratorContext class.

@ajbennieston ajbennieston self-assigned this Apr 13, 2018
ajbennieston added a commit that referenced this issue Apr 14, 2018
* N402: Add descriptions to binding generators.

Generators now include a description for each binding they register.

These can be used to add a `--list-generators` feature.

This commit contains work for issue #402.

* N402: Add test for generator descriptions.

* N402: Fix test by converting filter(...) output to a list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant