summaryrefslogtreecommitdiff
path: root/example.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-06-05 15:19:44 +1200
committerLars Wirzenius <liw@liw.fi>2010-06-05 15:19:44 +1200
commita55150325dd046e4b7ce239f8dbee8eea7bd8ad8 (patch)
tree434a4b990e18a2e2a918b444bef5ab7847480692 /example.py
parent46ef0bb1dc0e816c247358fff8e233c41394da74 (diff)
downloadttystatus-a55150325dd046e4b7ce239f8dbee8eea7bd8ad8.tar.gz
Add example program.
Diffstat (limited to 'example.py')
-rw-r--r--example.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/example.py b/example.py
new file mode 100644
index 0000000..476c4aa
--- /dev/null
+++ b/example.py
@@ -0,0 +1,37 @@
+# Copyright 2010 Lars Wirzenius
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+'''An example program for ttystatus.'''
+
+
+import os
+import sys
+
+import ttystatus
+
+
+def main():
+ m = ttystatus.Messager(period=0.1)
+ for dirname, subdirs, basenames in os.walk(sys.argv[1]):
+ for pathname in [os.path.join(dirname, x) for x in basenames]:
+ m.write(pathname)
+ if os.path.islink(pathname):
+ m.notify('Symlink! %s' % pathname)
+ m.finished()
+
+
+if __name__ == '__main__':
+ main()