Added tab-completion and cli-arguments

This commit is contained in:
Cametendo
2026-04-22 22:12:33 +02:00
parent 5fd53af017
commit d0d239e0ca
10 changed files with 223 additions and 85 deletions

View File

@@ -1,25 +1,34 @@
package org.cametendo;
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws InterruptedException {
public static void main(String[] args) throws InterruptedException, IOException {
Scanner UserInput = new Scanner(System.in);
Greeting.greeting();
String input = UserInput.nextLine();
if (YesNo.check(input)) {
System.out.println("Please choose the to be flashed device (f. e. sda)");
} else {
System.out.println("Canceling...");
System.exit(0);
if (args.length == 4) {
String validatedDevice = StorageDeviceLister.validateAndGetPath(args[0]);
if (validatedDevice == null) {
return;
}
StorageDeviceLister.deviceCheck(UserInput);
FilePathAdd.filePath(UserInput);
BlockSize.blockSize(UserInput);
OflagHandler.handleOflag(UserInput);
Flasher.flasher(UserInput);
String validatedFile = FilePathAdd.validateAndGetFile(args[1]);
if (validatedFile == null) {
return;
}
StorageDeviceLister.fullPath = validatedDevice;
FilePathAdd.ImagePath = validatedFile;
BlockSize.blockSizeString = BlockSize.mapBlockSize(args[2]);
OflagHandler.oflagHandleString = OflagHandler.mapOflagHandle(args[3]);
} else {
Greeting.greeting(UserInput);
StorageDeviceLister.deviceCheck(UserInput);
FilePathAdd.filePath();
BlockSize.blockSize(UserInput);
OflagHandler.Oflag(UserInput);
}
Flasher.flasher(UserInput);
}
}