Search in sources :

Example 1 with AllAvailableArguments

use of com.github.jankroken.commandline.annotations.AllAvailableArguments in project POL-POM-5 by PlayOnLinux.

the class CLIController method runScript.

@Option
@LongSwitch("script")
@ShortSwitch("s")
@AllAvailableArguments
public void runScript(List<String> arguments) {
    final String scriptPath = arguments.get(0);
    final File scriptFile = new File(scriptPath);
    final ScriptInterpreter scriptInterpreter = applicationContext.getBean("scriptInterpreter", ScriptInterpreter.class);
    scriptInterpreter.runScript(scriptFile, e -> {
        throw new IllegalStateException(e);
    });
}
Also used : ScriptInterpreter(org.phoenicis.scripts.interpreter.ScriptInterpreter) File(java.io.File) ShortSwitch(com.github.jankroken.commandline.annotations.ShortSwitch) Option(com.github.jankroken.commandline.annotations.Option) LongSwitch(com.github.jankroken.commandline.annotations.LongSwitch) AllAvailableArguments(com.github.jankroken.commandline.annotations.AllAvailableArguments)

Example 2 with AllAvailableArguments

use of com.github.jankroken.commandline.annotations.AllAvailableArguments in project POL-POM-5 by PlayOnLinux.

the class CLIController method installApp.

@Option
@LongSwitch("install")
@ShortSwitch("i")
@AllAvailableArguments
public void installApp(List<String> arguments) {
    final String categoryName = arguments.get(0);
    final String appName = arguments.get(1);
    final String scriptName = arguments.get(2);
    final ScriptDTO scriptDTO = repositoryManager.getScript(Arrays.asList(categoryName, appName, scriptName));
    scriptInterpreter.runScript(scriptDTO.getScript(), Throwable::printStackTrace);
}
Also used : ScriptDTO(org.phoenicis.repository.dto.ScriptDTO) ShortSwitch(com.github.jankroken.commandline.annotations.ShortSwitch) Option(com.github.jankroken.commandline.annotations.Option) LongSwitch(com.github.jankroken.commandline.annotations.LongSwitch) AllAvailableArguments(com.github.jankroken.commandline.annotations.AllAvailableArguments)

Example 3 with AllAvailableArguments

use of com.github.jankroken.commandline.annotations.AllAvailableArguments in project POL-POM-5 by PlayOnLinux.

the class CLIController method runApp.

@Option
@LongSwitch("run")
@ShortSwitch("r")
@AllAvailableArguments
public void runApp(List<String> arguments) {
    final String shortcutName = arguments.get(0);
    arguments.remove(0);
    final ShortcutRunner shortcutRunner = applicationContext.getBean(ShortcutRunner.class);
    shortcutRunner.run(shortcutName, arguments, e -> {
        throw new IllegalStateException(e);
    });
}
Also used : ShortcutRunner(org.phoenicis.library.ShortcutRunner) ShortSwitch(com.github.jankroken.commandline.annotations.ShortSwitch) Option(com.github.jankroken.commandline.annotations.Option) LongSwitch(com.github.jankroken.commandline.annotations.LongSwitch) AllAvailableArguments(com.github.jankroken.commandline.annotations.AllAvailableArguments)

Aggregations

AllAvailableArguments (com.github.jankroken.commandline.annotations.AllAvailableArguments)3 LongSwitch (com.github.jankroken.commandline.annotations.LongSwitch)3 Option (com.github.jankroken.commandline.annotations.Option)3 ShortSwitch (com.github.jankroken.commandline.annotations.ShortSwitch)3 File (java.io.File)1 ShortcutRunner (org.phoenicis.library.ShortcutRunner)1 ScriptDTO (org.phoenicis.repository.dto.ScriptDTO)1 ScriptInterpreter (org.phoenicis.scripts.interpreter.ScriptInterpreter)1