git config added
This commit is contained in:
+42
-1
@@ -19,7 +19,8 @@ read credentials or other answers from the terminal.
|
||||
Runs a registered Git @racket[command]. The arguments are passed to the command.
|
||||
Registered command symbols are @racket['status], @racket['add],
|
||||
@racket['commit], @racket['push], @racket['pull], @racket['fetch],
|
||||
@racket['branch], @racket['switch], @racket['clone], @racket['tag],
|
||||
@racket['config], @racket['branch], @racket['switch], @racket['clone],
|
||||
@racket['tag],
|
||||
@racket['log], @racket['rev-list], @racket['diff],
|
||||
@racket['show], @racket['grep], @racket['help], @racket['version], and
|
||||
@racket['new-version].
|
||||
@@ -88,6 +89,46 @@ For example:
|
||||
]
|
||||
}
|
||||
|
||||
@defproc[(git-config [argument any/c] ...) any/c]{
|
||||
Provides a Racket-oriented interface to @tt{git config}. The same interface is
|
||||
available through @racket[git] with command @racket['config].
|
||||
|
||||
@racketblock[
|
||||
(git 'config 'get '--all)
|
||||
]
|
||||
|
||||
returns all visible configuration entries as key/value items:
|
||||
|
||||
@racketblock[
|
||||
'(("user.name" "Hans Dijkema")
|
||||
("user.email" "hans@example.invalid")
|
||||
("credential.helper" "manager"))
|
||||
]
|
||||
|
||||
@racketblock[
|
||||
(git 'config 'get "credential.helper")
|
||||
]
|
||||
|
||||
returns one value as a string, or @racket[#f] when the key is absent.
|
||||
|
||||
@racketblock[
|
||||
(git 'config 'get '--all "credential.helper")
|
||||
]
|
||||
|
||||
returns all values for one key as a list. An absent key produces the empty
|
||||
list.
|
||||
|
||||
Configuration values can be written with @racket['set!]:
|
||||
|
||||
@racketblock[
|
||||
(git 'config 'set! "user.email" "hans@example.invalid")
|
||||
(git 'config 'set! '--global "user.email" "hans@example.invalid")
|
||||
]
|
||||
|
||||
The optional write scope can be @tt{--global}, @tt{--local}, or @tt{--system}.
|
||||
A successful write returns @racket[#t].
|
||||
}
|
||||
|
||||
@defproc[(git-branch [argument any/c] ...) boolean?]{
|
||||
Runs @tt{git branch} with the supplied arguments. This can be used to list,
|
||||
create, rename, or delete branches according to the options supported by the
|
||||
|
||||
Reference in New Issue
Block a user