Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
hrgdavor committed May 10, 2017
1 parent c500a16 commit fbbc56a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/hr/hrg/javawatcher/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void main(String[] args) throws Exception{

String pathToWatch = args[0];
String commandToRun = args[1];

boolean postChanges = false;
Logger log = LoggerFactory.getLogger(Main.class);

GlobWatcher watcher = new GlobWatcher(Paths.get(pathToWatch));
Expand All @@ -46,6 +46,8 @@ public static void main(String[] args) throws Exception{

}else if(args[i].startsWith("--exclude=")) {
watcher.excludes(args[i].substring(10));
}else if(args[i].equals("--postChanges")) {
postChanges = true;
}
}

Expand All @@ -58,7 +60,7 @@ public static void main(String[] args) throws Exception{
if(changed == null) break; // interrupted

System.out.println(sdf.format(new Date())+" - "+changed.size()+" files changed");
runScript(log,commandToRun, null, changed, true, System.out, System.err);
runScript(log,commandToRun, null, changed, postChanges, System.out, System.err);
}

}
Expand Down Expand Up @@ -134,7 +136,7 @@ private static void printHelp() {
System.out.println("Usage: folder script [arguments]");
System.out.println(" --burstDelay=x - number of miliseconds to wait before sending changes ");
System.out.println(" (some programs may generate more than one chenge event in very short time when writing a file) ");
System.out.println(" --postChanges=x - write changed files info to the script/url (script input stream or HTTP POST for url) ");
System.out.println(" --postChanges - write changed files info to the script/url (script input stream or HTTP POST for url) ");
System.out.println(" --include=pattern - can be used multiple times, defines an include pattern");
System.out.println(" --include=pattern - can be used multiple times, defines an include pattern");
System.out.println(" --exclude=pattern - can be used multiple times, defines an include pattern");
Expand Down

0 comments on commit fbbc56a

Please sign in to comment.