Skip to content

Commit

Permalink
Update readme with documentation.
Browse files Browse the repository at this point in the history
Signed-off-by: Gora Khargosh <gora.khargosh@gmail.com>
  • Loading branch information
gorakhargosh committed Nov 15, 2010
1 parent 7d2fb16 commit 3c31697
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,41 @@ Licensing
---------
Watchdog is licensed under the terms of the
[MIT License](http://www.opensource.org/licenses/mit-license.html "MIT License")

Usage:
------

import sys
import time
from watchdog import Observer, FileSystemEventHandler

class MyEventHandler(FileSystemEventHandler):
def on_moved(self, event):
# Do something.
pass

def on_created(self, event):
# Do something.
pass

def on_deleted(self, event):
# Do something.
pass

def on_modified(self, event):
# Do something.
pass

event_handler = MyEventHandler()
observer = Observer()
observer.schedule('a-unique-name', *sys.argv[1:], event_handler)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.unschedule('a-unique-name')
observer.stop()
raise
observer.join()

0 comments on commit 3c31697

Please sign in to comment.