More commands
This commit is contained in:
+111
-1
@@ -19,7 +19,7 @@ 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['config], @racket['branch], @racket['remote], @racket['switch], @racket['clone],
|
||||
@racket['config], @racket['branch], @racket['remote], @racket['stash], @racket['restore], @racket['reset], @racket['revert], @racket['rebase], @racket['merge], @racket['cherry-pick], @racket['switch], @racket['clone],
|
||||
@racket['tag],
|
||||
@racket['log], @racket['rev-list], @racket['diff],
|
||||
@racket['show], @racket['grep], @racket['help], @racket['version], and
|
||||
@@ -31,6 +31,27 @@ commands process the result into a Racket value, such as @racket['status],
|
||||
@racket['new-version].
|
||||
}
|
||||
|
||||
|
||||
@defform[(git* command argument ...)]{
|
||||
Provides compact command-style syntax for @racket[git]. The command name is
|
||||
used as a symbol. Other literal arguments are converted to strings.
|
||||
|
||||
@racketblock[
|
||||
(git* remote -v)
|
||||
(git* switch main)
|
||||
]
|
||||
|
||||
An argument written as @racket[(eval expression)] is evaluated instead of being
|
||||
converted from its literal syntax.
|
||||
|
||||
@racketblock[
|
||||
(define branch "develop")
|
||||
(git* switch (eval branch))
|
||||
]
|
||||
|
||||
@racket[gt] is retained as a compatibility alias for @racket[git*].
|
||||
}
|
||||
|
||||
@section{Provided commands}
|
||||
|
||||
@defproc[(git-status [argument any/c] ...) list?]{
|
||||
@@ -204,6 +225,95 @@ Other forms, including @tt{add}, @tt{rename}, @tt{remove}, @tt{set-head},
|
||||
@tt{show}, @tt{prune}, @tt{update}, @tt{set-branches}, and @tt{set-url}, are
|
||||
passed to Git unchanged and use the normal git-cli command result processing.
|
||||
}
|
||||
@defproc[(git-stash [argument any/c] ...) (or/c boolean? list?)]{
|
||||
Runs @tt{git stash} with the supplied arguments. Calling it without a
|
||||
subcommand keeps Git's normal behavior, which is equivalent to
|
||||
@tt{git stash push}.
|
||||
|
||||
@tt{git stash list} is returned as structured Racket data. Each item contains
|
||||
the stash reference and Git's stash description.
|
||||
|
||||
@racketblock[
|
||||
(git-stash 'list)
|
||||
|
||||
'(("stash@{0}" "WIP on main: 1234567 Example")
|
||||
("stash@{1}" "On main: older work"))
|
||||
]
|
||||
|
||||
The structured form is only used when the caller has not supplied a
|
||||
@tt{--format} or @tt{--pretty} option. Explicit Git formatting is left
|
||||
unchanged.
|
||||
|
||||
Other stash subcommands, including @tt{push}, @tt{show}, @tt{pop},
|
||||
@tt{apply}, @tt{drop}, @tt{clear}, @tt{branch}, @tt{create}, @tt{store},
|
||||
@tt{export}, and @tt{import}, are passed to Git unchanged.
|
||||
}
|
||||
|
||||
@defproc[(git-restore [argument any/c] ...) boolean?]{
|
||||
Runs @tt{git restore} with the supplied arguments. Git's path, source,
|
||||
@tt{--staged}, @tt{--worktree}, and patch semantics are preserved.
|
||||
|
||||
@racketblock[
|
||||
(git-restore "main.rkt")
|
||||
(git-restore '--staged "main.rkt")
|
||||
(git* restore --source=HEAD~1 main.rkt)
|
||||
]
|
||||
}
|
||||
|
||||
@defproc[(git-reset [argument any/c] ...) boolean?]{
|
||||
Runs @tt{git reset} with the supplied arguments. Modes such as @tt{--soft},
|
||||
@tt{--mixed}, @tt{--hard}, @tt{--merge}, and @tt{--keep}, as well as path
|
||||
forms, are passed through unchanged.
|
||||
|
||||
@racketblock[
|
||||
(git-reset '--hard 'HEAD)
|
||||
(git* reset --soft HEAD~1)
|
||||
]
|
||||
}
|
||||
|
||||
@defproc[(git-revert [argument any/c] ...) boolean?]{
|
||||
Runs @tt{git revert} with the supplied arguments. Sequencer controls such as
|
||||
@tt{--continue}, @tt{--skip}, @tt{--quit}, and @tt{--abort} are passed through
|
||||
unchanged.
|
||||
|
||||
@racketblock[
|
||||
(git-revert 'HEAD)
|
||||
(git* revert --abort)
|
||||
]
|
||||
}
|
||||
|
||||
@defproc[(git-rebase [argument any/c] ...) boolean?]{
|
||||
Runs @tt{git rebase} with the supplied arguments, including normal, interactive,
|
||||
and continuation/abort forms.
|
||||
|
||||
@racketblock[
|
||||
(git-rebase "main")
|
||||
(git* rebase --continue)
|
||||
(git* rebase --abort)
|
||||
]
|
||||
}
|
||||
|
||||
@defproc[(git-merge [argument any/c] ...) boolean?]{
|
||||
Runs @tt{git merge} with the supplied arguments and preserves Git's merge
|
||||
options and control forms.
|
||||
|
||||
@racketblock[
|
||||
(git-merge "feature")
|
||||
(git* merge --abort)
|
||||
]
|
||||
}
|
||||
|
||||
@defproc[(git-cherry-pick [argument any/c] ...) boolean?]{
|
||||
Runs @tt{git cherry-pick} with the supplied arguments. Sequencer controls such
|
||||
as @tt{--continue}, @tt{--skip}, @tt{--quit}, and @tt{--abort} are passed
|
||||
through unchanged.
|
||||
|
||||
@racketblock[
|
||||
(git-cherry-pick "abc1234")
|
||||
(git* cherry-pick --continue)
|
||||
]
|
||||
}
|
||||
|
||||
@defproc[(git-switch [argument any/c] ...) boolean?]{
|
||||
Runs @tt{git switch} with the supplied arguments.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user