ConsoleApplication examples?

Are there any examples of ConsoleApplication, including the built in support for parsing the command line arguments, etc…

1 Like

pluginval can be run in a headless mode (command line only):

Thanks I will check that one out!

It’s not much different than writing a non-JUCE console app – include whatever JUCE headers you need, write a main() function and you’re good to go. You can use JUCE’s ArgumentList to parse the arguments like:

int main (int argc, char** argv)
    auto args = juce::ArgumentList (argc, argv);

    // use 'args' to check if arguments exist, retrieve their values, etc.
    args.failIfOptionIsMissing ("required_arg");
    auto requiredValue = args.getValueForOption ("required_arg");

    if (args.contains ("optional_arg"))
        auto optionalValue = args.getValueForOption ("optional_arg");