Add CLI usage details
This commit is contained in:
parent
68efc348bd
commit
306bb78c61
|
@ -19,14 +19,34 @@ public class AnalyzeDirectory {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException, TikaException, SAXException {
|
private static void usage() {
|
||||||
String directory = args[0];
|
System.out.println("Usage: AnalyzeDirectory <directory> <option>");
|
||||||
readFiles(directory);
|
System.out.println("option metadata: shows the filename/file type/encoding and language of the files");
|
||||||
|
System.out.println("option links: shows all the links contained in each file");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void chooseAction(String action) {
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
FileData data = new FileData(file);
|
FileData data = new FileData(file);
|
||||||
System.out.println(data);
|
if (action == "metadata") {
|
||||||
|
System.out.println(data);
|
||||||
|
} else if (action == "links") {
|
||||||
|
data.getLinks();
|
||||||
|
} else {
|
||||||
|
usage();
|
||||||
|
}
|
||||||
System.out.println("--------------------------------------------------------------------------");
|
System.out.println("--------------------------------------------------------------------------");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException, TikaException, SAXException {
|
||||||
|
if (args.length != 2) {
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
String directory = args[0];
|
||||||
|
readFiles(directory);
|
||||||
|
chooseAction(args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue