Move From CLI Magic Numbers
This commit is contained in:
parent
9922ec389c
commit
5eed22ddb2
|
@ -202,8 +202,8 @@ public class BytecodeViewer
|
|||
MiscUtils.setLanguage(MiscUtils.guessLanguage());
|
||||
|
||||
//handle CLI
|
||||
int isCLI = CommandLineInput.parseCommandLine(args);
|
||||
if (isCLI == CommandLineInput.STOP)
|
||||
CLIAction isCLI = CommandLineInput.parseCommandLine(args);
|
||||
if (isCLI == CLIAction.STOP)
|
||||
return;
|
||||
|
||||
//load with shaded libraries
|
||||
|
@ -214,11 +214,11 @@ public class BytecodeViewer
|
|||
else //load through bootloader
|
||||
{
|
||||
BOOT_CHECK.start();
|
||||
Boot.boot(args, isCLI != CommandLineInput.GUI);
|
||||
Boot.boot(args, isCLI != CLIAction.GUI);
|
||||
}
|
||||
|
||||
//CLI arguments say spawn the GUI
|
||||
if (isCLI == CommandLineInput.GUI)
|
||||
if (isCLI == CLIAction.GUI)
|
||||
{
|
||||
BytecodeViewer.boot(false);
|
||||
Configuration.bootState = BootState.GUI_SHOWING;
|
||||
|
|
|
@ -27,11 +27,13 @@ import org.objectweb.asm.ClassWriter;
|
|||
import org.objectweb.asm.tree.ClassNode;
|
||||
import the.bytecode.club.bytecodeviewer.decompilers.Decompiler;
|
||||
import the.bytecode.club.bytecodeviewer.translation.Language;
|
||||
import the.bytecode.club.bytecodeviewer.util.CLIAction;
|
||||
import the.bytecode.club.bytecodeviewer.util.JarUtils;
|
||||
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static the.bytecode.club.bytecodeviewer.util.CLIAction.*;
|
||||
import static the.bytecode.club.bytecodeviewer.Constants.*;
|
||||
|
||||
/**
|
||||
|
@ -46,11 +48,6 @@ public class CommandLineInput
|
|||
private static final Options OPTIONS = new Options();
|
||||
private static final CommandLineParser PARSER = new DefaultParser();
|
||||
|
||||
/*BECAUSE WHO DOESN'T LOVE MAGIC NUMBERS*/
|
||||
public static final int STOP = -1;
|
||||
public static final int GUI = 0;
|
||||
public static final int CLI = 1;
|
||||
|
||||
static
|
||||
{
|
||||
OPTIONS.addOption("help", false, "prints the help menu.");
|
||||
|
@ -92,7 +89,7 @@ public class CommandLineInput
|
|||
return false;
|
||||
}
|
||||
|
||||
public static int parseCommandLine(String[] args)
|
||||
public static CLIAction parseCommandLine(String[] args)
|
||||
{
|
||||
if (!containsCommand(args))
|
||||
return GUI;
|
||||
|
|
|
@ -109,10 +109,9 @@ public class BootCheck implements Runnable
|
|||
|
||||
Boot.hide();
|
||||
|
||||
int CLI = CommandLineInput.parseCommandLine(BytecodeViewer.launchArgs);
|
||||
CLIAction CLI = CommandLineInput.parseCommandLine(BytecodeViewer.launchArgs);
|
||||
|
||||
|
||||
if (CLI == CommandLineInput.GUI)
|
||||
if (CLI == CLIAction.GUI)
|
||||
BytecodeViewer.boot(false);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package the.bytecode.club.bytecodeviewer.util;
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @since 9/27/2024
|
||||
*/
|
||||
public enum CLIAction
|
||||
{
|
||||
STOP,
|
||||
GUI,
|
||||
CLI
|
||||
}
|
Loading…
Reference in New Issue
Block a user