You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2019/11/22 11:40:20 UTC

[cordova-cli] branch master updated: fix: cannot call config or create commands (#495)

This is an automated email from the ASF dual-hosted git repository.

raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new 838a057  fix: cannot call config or create commands (#495)
838a057 is described below

commit 838a05784a3bc040fbf1ec223fba976663954234
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Fri Nov 22 12:40:14 2019 +0100

    fix: cannot call config or create commands (#495)
    
    A few exceptions aside, the `cli` function checks if the current command
    exists as a property in `cordova-lib`. If not, it throws an error that
    the command is unsupported:
    
        Cordova does not know config;
        try `cordova help` for a list of all the available commands.
    
    Since the `config` and `create` commands are not handled by
    `cordova-lib` anymore and their previous implementations in
    `cordova-lib` have recently been removed, we need to make an exceptions
    for those commands.
---
 src/cli.js | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/cli.js b/src/cli.js
index 913da00..870b1c4 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -340,6 +340,14 @@ function cli (inputArgs) {
         return printHelp(remain);
     }
 
+    // Don't need to do anything with cordova-lib since config was handled above
+    if (cmd === 'config') return true;
+
+    if (cmd === 'create') {
+        const [, dest, id, name] = undashed;
+        return cordovaCreate(dest, { id, name, events, template: args.template });
+    }
+
     if (!Object.prototype.hasOwnProperty.call(cordova, cmd)) {
         var msg2 = 'Cordova does not know ' + cmd + '; try `' + cordova_lib.binname +
             ' help` for a list of all the available commands.';
@@ -409,12 +417,6 @@ function cli (inputArgs) {
     } else if (cmd === 'serve') {
         var port = undashed[1];
         return cordova.serve(port);
-    } else if (cmd === 'create') {
-        const [, dest, id, name] = undashed;
-        return cordovaCreate(dest, { id, name, events, template: args.template });
-    } else if (cmd === 'config') {
-        // Don't need to do anything with cordova-lib since config was handled above
-        return true;
     } else {
         // platform/plugins add/rm [target(s)]
         subcommand = undashed[1]; // sub-command like "add", "ls", "rm" etc.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org