added version increment script
This commit is contained in:
30
.scripts/vincr.zp
Normal file
30
.scripts/vincr.zp
Normal file
@@ -0,0 +1,30 @@
|
||||
(define (die msg)
|
||||
(begin
|
||||
(write msg)
|
||||
(exit 1)))
|
||||
|
||||
(define (usage)
|
||||
(die "increment_version [position]\n\tposition defaults to 2"))
|
||||
|
||||
(define (parse-args)
|
||||
(cond
|
||||
((eq? 0 (length zepto:args)) 2)
|
||||
((and (string:num? (car zepto:args))
|
||||
(eq? 1 (length zepto:args)))
|
||||
(string->number (car zepto:args)))
|
||||
(else (usage))))
|
||||
|
||||
(define (main position)
|
||||
(if (not (file-exists? "VERSION"))
|
||||
(die "A version file is needed in the current directory")
|
||||
(let* ((version (read-contents "VERSION"))
|
||||
(new-version (|> (string:split version ".")
|
||||
(curry map string->number)
|
||||
list->vector
|
||||
($ (vector:update % position add1))
|
||||
(curry vector:map number->string)
|
||||
($ (string:join % ".")))))
|
||||
(with-output-file "VERSION" (curry write new-version)))))
|
||||
|
||||
(main (parse-args))
|
||||
(exit 0)
|
3
zshrc
3
zshrc
@@ -38,6 +38,7 @@ alias dob="git branch --merged | grep -vE '(\*)|(master)|(dev)' | xargs -n 1 git
|
||||
alias vi="stty stop '' -ixoff ; vim"
|
||||
alias gcc="gcc-6"
|
||||
alias g++="g++-6"
|
||||
alias increment_version="zepto ~/.scripts/vincr.zp"
|
||||
alias psh="perl ~/.scripts/psh"
|
||||
alias push="git push"
|
||||
alias pull="git pull"
|
||||
@@ -418,4 +419,4 @@ function zeptosay () {
|
||||
|
||||
fortune | zeptosay
|
||||
|
||||
#source ~/.zshrc.priv
|
||||
source ~/.zshrc.priv
|
||||
|
Reference in New Issue
Block a user