From 2d81602cf6c3f78201c2ede24a775f057214292b Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 11 Jun 2016 17:53:09 -0400 Subject: [PATCH] Change --clean's abbreviation to -n, and add some more useful output. --- gitup/config.py | 4 +++- gitup/script.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gitup/config.py b/gitup/config.py index 195dda7..cb6c742 100644 --- a/gitup/config.py +++ b/gitup/config.py @@ -32,7 +32,7 @@ def _load_config_file(config_path=None): try: with open(cfg_path, "rb") as config_file: - paths = config_file.read().split(b"\n") + paths = config_file.read().strip().split(b"\n") return [path.decode("utf8") for path in paths] except IOError: return [] @@ -118,10 +118,12 @@ def clean_bookmarks(config_path=None): """Delete any bookmarks that don't exist.""" bookmarks = _load_config_file(config_path) if not bookmarks: + print("You have no bookmarks to clean up.") return delete = [path for path in bookmarks if not os.path.isdir(path)] if not delete: + print("All of your bookmarks are valid.") return bookmarks = [path for path in bookmarks if path not in delete] diff --git a/gitup/script.py b/gitup/script.py index 514f3ad..32fe441 100644 --- a/gitup/script.py +++ b/gitup/script.py @@ -64,7 +64,7 @@ def main(): '-l', '--list', dest="list_bookmarks", action="store_true", help="list current bookmarks") group_b.add_argument( - '-e', '--clean', '--cleanup', dest="clean_bookmarks", + '-n', '--clean', '--cleanup', dest="clean_bookmarks", action="store_true", help="delete any bookmarks that don't exist") group_b.add_argument( '-b', '--bookmark-file', nargs="?", metavar="path", type=_decode,