f393d2ad42d7

Implement -0.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 22 Sep 2012 15:31:16 -0400
parents 0dd807c320ab
children a8b6ed833a30
branches/tags (none)
files ffind

Changes

--- a/ffind	Sat Sep 22 15:26:22 2012 -0400
+++ b/ffind	Sat Sep 22 15:31:16 2012 -0400
@@ -27,8 +27,8 @@
 options = None
 
 # Output ----------------------------------------------------------------------
-def out(s):
-    sys.stdout.write(s + '\n')
+def out(s, line_ending='\n'):
+    sys.stdout.write(s + line_ending)
 
 def err(s):
     sys.stderr.write(s + '\n')
@@ -63,7 +63,7 @@
         path = os.path.join(dir, item)
         if not should_ignore(item, path):
             if match(query, path):
-                print path
+                out(path, '\0' if options.zero else '\n')
 
             is_dir = os.path.isdir(path)
             if is_dir: