[PATCH] add --without-files to find only objects lacking files

Martin Dengler martinatmartindengler.com
Sun Oct 26 17:58:33 EDT 2008


---
 lsjournal |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/lsjournal b/lsjournal
index 7083002..852dc18 100755
--- a/lsjournal
+++ b/lsjournal
@@ -60,6 +60,11 @@ def build_option_parser():
      help="show all metadata and properties",
      default=False)
 
+    parser.add_option("-W", "--without-files", action="store_true",
+     dest="without_files",
+     help="only return items without a file path",
+     default=False)
+
     return parser
 
 if __name__ == "__main__":
@@ -86,7 +91,9 @@ if __name__ == "__main__":
     objects, count = datastore.find(query, sorting='-mtime')
 
     for i in range(count):
-        if not options.all and not objects[i].file_path:
+        if ((options.without_files and objects[i].file_path) or
+            (not (options.all or options.without_files)
+             and not objects[i].file_path)):
             objects[i].destroy()
             continue
         if options.debug:
-- 
1.5.5.1





More information about the Sugar-devel mailing list