Ejemplo n.º 1
0
//==============================================================================
int performCommandLine (const String& commandLine)
{
    StringArray args;
    args.addTokens (commandLine, true);
    args.trim();

    String command (args[0]);

    try
    {
        if (matchArgument (command, "help"))                     { showHelp(); return 0; }
        if (matchArgument (command, "h"))                        { showHelp(); return 0; }
        if (matchArgument (command, "resave"))                   { resaveProject (args, false); return 0; }
        if (matchArgument (command, "resave-resources"))         { resaveProject (args, true); return 0; }
        if (matchArgument (command, "set-version"))              { setVersion (args); return 0; }
        if (matchArgument (command, "bump-version"))             { bumpVersion (args); return 0; }
        if (matchArgument (command, "git-tag-version"))          { gitTag (args); return 0; }
        if (matchArgument (command, "buildmodule"))              { buildModules (args, false); return 0; }
        if (matchArgument (command, "buildallmodules"))          { buildModules (args, true); return 0; }
        if (matchArgument (command, "status"))                   { showStatus (args); return 0; }
        if (matchArgument (command, "trim-whitespace"))          { cleanWhitespace (args, false); return 0; }
        if (matchArgument (command, "remove-tabs"))              { cleanWhitespace (args, true); return 0; }
        if (matchArgument (command, "tidy-divider-comments"))    { tidyDividerComments (args); return 0; }
        if (matchArgument (command, "fix-broken-include-paths")) { fixRelativeIncludePaths (args); return 0; }
    }
    catch (const CommandLineError& error)
    {
        std::cout << error.message << std::endl << std::endl;
        return 1;
    }

    return commandLineNotPerformed;
}
Ejemplo n.º 2
0
//==============================================================================
int performCommandLine (const String& commandLine)
{
    StringArray args;
    args.addTokens (commandLine, true);
    args.trim();

    if (findArgument (args, "--lf") || findArgument (args, "-lf"))
       preferredLinefeed = "\n";

    String command (args[0]);

    try
    {
        if (matchArgument (command, "help"))                     { showHelp();                            return 0; }
        if (matchArgument (command, "h"))                        { showHelp();                            return 0; }
        if (matchArgument (command, "resave"))                   { resaveProject (args, false);           return 0; }
        if (matchArgument (command, "resave-resources"))         { resaveProject (args, true);            return 0; }
        if (matchArgument (command, "get-version"))              { getVersion (args);                     return 0; }
        if (matchArgument (command, "set-version"))              { setVersion (args);                     return 0; }
        if (matchArgument (command, "bump-version"))             { bumpVersion (args);                    return 0; }
        if (matchArgument (command, "git-tag-version"))          { gitTag (args);                         return 0; }
        if (matchArgument (command, "buildmodule"))              { buildModules (args, false);            return 0; }
        if (matchArgument (command, "buildallmodules"))          { buildModules (args, true);             return 0; }
        if (matchArgument (command, "status"))                   { showStatus (args);                     return 0; }
        if (matchArgument (command, "trim-whitespace"))          { cleanWhitespace (args, false);         return 0; }
        if (matchArgument (command, "remove-tabs"))              { cleanWhitespace (args, true);          return 0; }
        if (matchArgument (command, "tidy-divider-comments"))    { tidyDividerComments (args);            return 0; }
        if (matchArgument (command, "fix-broken-include-paths")) { fixRelativeIncludePaths (args);        return 0; }
        if (matchArgument (command, "obfuscated-string-code"))   { generateObfuscatedStringCode (args);   return 0; }
        if (matchArgument (command, "encode-binary"))            { encodeBinary (args);                   return 0; }
        if (matchArgument (command, "trans"))                    { scanFoldersForTranslationFiles (args); return 0; }
        if (matchArgument (command, "trans-finish"))             { createFinishedTranslationFile (args);  return 0; }
        if (matchArgument (command, "set-global-search-path"))   { setGlobalPath (args);                  return 0; }
        if (matchArgument (command, "create-project-from-pip"))  { createProjectFromPIP (args);           return 0; }
    }
    catch (const CommandLineError& error)
    {
        std::cout << error.message << std::endl << std::endl;
        return 1;
    }

    return commandLineNotPerformed;
}