Bladeren bron

Change --clean's abbreviation to -n, and add some more useful output.

tags/v0.4
Ben Kurtovic 8 jaren geleden
bovenliggende
commit
2d81602cf6
2 gewijzigde bestanden met toevoegingen van 4 en 2 verwijderingen
  1. +3
    -1
      gitup/config.py
  2. +1
    -1
      gitup/script.py

+ 3
- 1
gitup/config.py Bestand weergeven

@@ -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]


+ 1
- 1
gitup/script.py Bestand weergeven

@@ -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,


Laden…
Annuleren
Opslaan