Uploaded image for project: 'Appcelerator Studio'
  1. Appcelerator Studio
  2. TISTUD-7733

CLI: Allow commands to be explicitly named

    Details

    • Type: Improvement
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:

      Ti CLI 3.6.0-dev

      Description

      When creating custom commands, the command name is for the moment based on the name of the file containing it.

      For instance, if I create a Ti-CLI plugin with a command written in a file called hello.js, the command will automatically be named hello. Problem is, I may create a command in a build.js file, and this command would overload the default build command. The current command API does not provide any mean for developers to alias command names, and therefore forces them to use complex filenames.

      This proposal introduces a name attribute in the command API, allowing command names to be based on this attribute and not on the name of the containing file. In case this name is not exported by the command, then the command filename should continue to be used as the command name.

      For instance, if I create a command in a file named /path/to/my/plugin/build.js, it would export a name attribute:

      exports.cliVersion = '>=3.2';
      exports.name = 'myproject:build';
      exports.desc = 'Runs all the tasks specific to building my project';
       
      exports.config = function(logger, config, cli) {
          // config here
      };
       
      exports.validate = function (logger, config, cli) {
          // validation here
      };
       
      exports.run = function (logger, config, cli, finished) {
          // run here
      };
      

      This command will be callable as titanium myproject:build, and not only titanium build.

        Attachments

          Activity

            People

            • Assignee:
              kkolipaka Kondal Kolipaka (Inactive)
              Reporter:
              xavier Xavier Lacot
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: