Selaa lähdekoodia

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

tags/v0.4
Ben Kurtovic 8 vuotta sitten
vanhempi
commit
2d81602cf6
2 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  1. +3
    -1
      gitup/config.py
  2. +1
    -1
      gitup/script.py

+ 3
- 1
gitup/config.py Näytä tiedosto

@@ -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 Näytä tiedosto

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


Ladataan…
Peruuta
Tallenna