cli.git: Add more git commands.
parent
6df7360ec9
commit
76e50c3479
|
@ -9,6 +9,12 @@ IN: cli.git
|
|||
SYMBOL: cli-git-num-parallel
|
||||
cli-git-num-parallel [ cpus 2 * ] initialize
|
||||
|
||||
: git-command>string ( quot -- string )
|
||||
utf8 <process-reader> stream-contents [ blank? ] trim-tail ;
|
||||
|
||||
: git-command>lines ( quot -- string )
|
||||
utf8 <process-reader> stream-lines ;
|
||||
|
||||
: git-clone-as ( uri path -- process ) [ { "git" "clone" } ] 2dip 2array append run-process ;
|
||||
: git-clone ( uri -- process ) [ { "git" "clone" } ] dip suffix run-process ;
|
||||
: git-pull* ( -- process ) { "git" "pull" } run-process ;
|
||||
|
@ -27,6 +33,12 @@ cli-git-num-parallel [ cpus 2 * ] initialize
|
|||
: git-remote-add ( path remote uri -- process ) '[ _ _ git-remote-add* ] with-directory ;
|
||||
: git-remote-get-url* ( remote -- process ) [ { "git" "remote" "get-url" } ] dip suffix run-process ;
|
||||
: git-remote-get-url ( path remote -- process ) '[ _ git-remote-get-url* ] with-directory ;
|
||||
: git-rev-parse* ( branch -- string ) [ { "git" "rev-parse" } ] dip suffix git-command>string ;
|
||||
: git-rev-parse ( path branch -- string ) '[ _ git-rev-parse* ] with-directory ;
|
||||
: git-diff-name-only* ( from to -- lines )
|
||||
[ { "git" "diff" "--name-only" } ] 2dip 2array append git-command>lines ;
|
||||
: git-diff-name-only ( path from to -- lines )
|
||||
[ git-diff-name-only* ] with-directory ;
|
||||
|
||||
: git-repository? ( directory -- ? )
|
||||
".git" append-path current-directory get prepend-path
|
||||
|
@ -34,9 +46,7 @@ cli-git-num-parallel [ cpus 2 * ] initialize
|
|||
|
||||
: git-current-branch* ( -- name )
|
||||
! { "git" "rev-parse" "--abbrev-ref" "HEAD" }
|
||||
{ "git" "name-rev" "--name-only" "HEAD" }
|
||||
utf8 <process-reader> stream-contents
|
||||
[ blank? ] trim-tail ;
|
||||
{ "git" "name-rev" "--name-only" "HEAD" } git-command>string ;
|
||||
|
||||
: git-current-branch ( directory -- name )
|
||||
[ git-current-branch* ] with-directory ;
|
||||
|
|
Loading…
Reference in New Issue