qooxdoo-archive / qooxdoo-cli

(deprecated, moved into qooxdoo-compiler) qx commandline
MIT License
4 stars 5 forks source link

adds basic implementation of 'qx add' #83

Closed cboulanger closed 6 years ago

cboulanger commented 6 years ago

This is an implementation of qx add class as outlined in #82. Contrib support hasn't been implemented yet.

(updated to reflect current code)

/**
 * Add a new class file to the current project, based on a template.
 *
 * Syntax: `qx add class <classname> [--type=template_name] [--extend=extended_class] [--import] [--from-contrib=contrib_name]`
 * If omitted, `--type` defaults to "default". The path to the template file will be calculated as follows:
 * 1. transform template_name to ${template_name}.tmpl.js
 * 2. check if this file exists in the "templates/class" folder 
 *    a. of a contrib, if the --from-contrib paramater wass passed (not implemented)
 *    b. otherwise, of the current project
 *    c. finally, of the CLI library
 *
 * If the --import flag is set, copy the template to the templates/class folder of the current project,
 * so it can be customized and used instead of the one shipped with the CLI.
 * 
 * If you place a file named `header.js` in the root of your project, this header will be used verbatim
 * as the ${header} template variable instead of the generic header template, which is populated with 
 * information from Manifest.json
 * 
 * (Contrib support is not yet implemented)
 * 
 */
cboulanger commented 6 years ago

Ok, I replaced the big fat comments with smaller ones containing explanations. As I said before, the default templates will be mainly used by beginners and in tutorials, so I think those are useful. The templates should show as much functionality of the class system as possible, but still be usable. If you have more suggestions how to improve them, I would ask you to do that in separate PRs, so that we get the main feature into qooxdoo-cli now.

johnspackman commented 6 years ago

5 approvals, merging. thank you @cboulanger !