Add remove function
When using this program it might happen that you have added a repository that you would like to have removed, now that is possible.
This commit is contained in:
parent
8b7ad95ade
commit
834855c0b3
1 changed files with 15 additions and 1 deletions
16
gitto.scm
16
gitto.scm
|
@ -30,6 +30,7 @@
|
|||
(display "\
|
||||
gitto [options]
|
||||
-r, --register REPO Register a new repository directory
|
||||
-R, --remove REPO Repmove a repository directory
|
||||
-v, --version Display version
|
||||
-h, --help Display this help
|
||||
"))
|
||||
|
@ -61,6 +62,15 @@ gitto [options]
|
|||
(display "Repository already registered."))
|
||||
(newline))
|
||||
|
||||
(define (remove-repository repository)
|
||||
(if (member repository repositories)
|
||||
(begin
|
||||
(set! repositories (delete repository repositories))
|
||||
(save-repositories-list)
|
||||
(simple-format #t "Repository ~A removed." repository))
|
||||
(display "Not a registered repository."))
|
||||
(newline))
|
||||
|
||||
(define (git-revs-to-push)
|
||||
(let* ((response (open-input-pipe "git log --pretty=oneline @{u}.. | wc -l"))
|
||||
(num (string->number (read-line response))))
|
||||
|
@ -94,14 +104,18 @@ gitto [options]
|
|||
`((version (single-char #\v) (value #f))
|
||||
(help (single-char #\h) (value #f))
|
||||
(register (single-char #\r) (value #t)
|
||||
(predicate ,git-dir?))
|
||||
(remove (single-char #\R) (value #t)
|
||||
(predicate ,git-dir?))))
|
||||
|
||||
(define (main args)
|
||||
(let* ((options (getopt-long args option-spec))
|
||||
(help-wanted (option-ref options 'help #f))
|
||||
(version-wanted (option-ref options 'version #f))
|
||||
(registration-needed (option-ref options 'register #f)))
|
||||
(registration-needed (option-ref options 'register #f))
|
||||
(removal (option-ref options 'remove #f)))
|
||||
(cond (version-wanted (version))
|
||||
(help-wanted (help))
|
||||
(registration-needed => register-repository)
|
||||
(removal => remove-repository)
|
||||
(#t (list-repositories)))))
|
||||
|
|
Loading…
Reference in a new issue