Commit fa98da96 authored by Carlos Galindo's avatar Carlos Galindo
Browse files

Improved argument handling and error messages

parent ca274a3c
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -39,6 +39,11 @@ public class EKnife

	public static void main(String[] args)
	{
		if (args.length == 0) {
			EKnife.printHelp();
			return;
		}

		final Args arguments = EKnife.processArguments(args);

		if (!arguments.isValid()) {
@@ -186,12 +191,12 @@ public class EKnife
				errors.add("You must specify a file to analyze with '-i'.");
			else if (!new File(inputPath).exists())
				errors.add("The input file you've specified does not exist or isn't readable(" + inputPath + ").");
			else if (file == null)
				errors.add("The input file is a folder, so you must specify a the file that contains the slicing criterion with '-f'.");
			if (outputFile == null)
				errors.add("You must specify a location for the output with '-o'.");
			else if (!outputFile.exists() && !outputFile.getAbsoluteFile().getParentFile().isDirectory())
				errors.add("The output file's parent folder does not exist, or the output folder does not exist.");
			if (file == null)
				errors.add("The input file is a folder, so you must specify a the file that contains the slicing criterion with '-f'.");
			if (line <= 0)
				errors.add("You must specify a line number greater than 0 with '-l'.");
			if (name == null || name.isEmpty())