Search in sources :

Example 1 with Command

use of org.jf.util.jcommander.Command in project smali by JesusFreke.

the class ListCommand method run.

@Override
public void run() {
    JCommander jc = getJCommander();
    if (help || jc.getParsedCommand() == null) {
        usage();
        return;
    }
    Command command = (Command) jc.getCommands().get(jc.getParsedCommand()).getObjects().get(0);
    command.run();
}
Also used : ListHlepCommand(org.jf.baksmali.ListHelpCommand.ListHlepCommand) Command(org.jf.util.jcommander.Command) JCommander(com.beust.jcommander.JCommander)

Example 2 with Command

use of org.jf.util.jcommander.Command in project smali by JesusFreke.

the class Main method main.

public static void main(String[] args) {
    Main main = new Main();
    JCommander jc = new JCommander(main);
    main.jc = jc;
    jc.setProgramName("baksmali");
    List<JCommander> commandHierarchy = main.getCommandHierarchy();
    ExtendedCommands.addExtendedCommand(jc, new DisassembleCommand(commandHierarchy));
    ExtendedCommands.addExtendedCommand(jc, new DeodexCommand(commandHierarchy));
    ExtendedCommands.addExtendedCommand(jc, new DumpCommand(commandHierarchy));
    ExtendedCommands.addExtendedCommand(jc, new HelpCommand(commandHierarchy));
    ExtendedCommands.addExtendedCommand(jc, new HlepCommand(commandHierarchy));
    ExtendedCommands.addExtendedCommand(jc, new ListCommand(commandHierarchy));
    jc.parse(args);
    if (main.version) {
        version();
    }
    if (jc.getParsedCommand() == null || main.help) {
        main.usage();
        return;
    }
    Command command = (Command) jc.getCommands().get(jc.getParsedCommand()).getObjects().get(0);
    command.run();
}
Also used : HlepCommand(org.jf.baksmali.HelpCommand.HlepCommand) Command(org.jf.util.jcommander.Command) HlepCommand(org.jf.baksmali.HelpCommand.HlepCommand) JCommander(com.beust.jcommander.JCommander)

Example 3 with Command

use of org.jf.util.jcommander.Command in project smali by JesusFreke.

the class Main method main.

public static void main(String[] args) {
    Main main = new Main();
    JCommander jc = new JCommander(main);
    main.jc = jc;
    jc.setProgramName("smali");
    List<JCommander> commandHierarchy = main.getCommandHierarchy();
    ExtendedCommands.addExtendedCommand(jc, new AssembleCommand(commandHierarchy));
    ExtendedCommands.addExtendedCommand(jc, new HelpCommand(commandHierarchy));
    ExtendedCommands.addExtendedCommand(jc, new HlepCommand(commandHierarchy));
    jc.parse(args);
    if (main.version) {
        version();
    }
    if (jc.getParsedCommand() == null || main.help) {
        main.usage();
        return;
    }
    Command command = (Command) jc.getCommands().get(jc.getParsedCommand()).getObjects().get(0);
    command.run();
}
Also used : HlepCommand(org.jf.smali.HelpCommand.HlepCommand) Command(org.jf.util.jcommander.Command) HlepCommand(org.jf.smali.HelpCommand.HlepCommand) JCommander(com.beust.jcommander.JCommander)

Aggregations

JCommander (com.beust.jcommander.JCommander)3 Command (org.jf.util.jcommander.Command)3 HlepCommand (org.jf.baksmali.HelpCommand.HlepCommand)1 ListHlepCommand (org.jf.baksmali.ListHelpCommand.ListHlepCommand)1 HlepCommand (org.jf.smali.HelpCommand.HlepCommand)1