Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// The target directory to clone into. If empty, the repository name is used.
Dir string
// The Git branch to clone.
Branch string
// The Git tag to clone.
Tag string
// The Git commit hash to clone.
Commit string
// Forcefully write files into the existing target directory.
Force bool
}
The configuration for the `Clone` function.
type Result ¶
type Result struct {
// The relative path to the target directory.
TargetDirRel string
// The absolute path to the target directory.
TargetDirAbs string
// The owner of the repository, typically the user or organisation.
RepoOwner string
// The name of the repository.
RepoName string
// The commit, tag, or branch used to clone the repository.
RepoFragment string
}
The result of the `Clone` function.
func Clone ¶
Clones the given repository using the configuration provided. The default behaviour clones the HEAD of the default branch.
res, err := gitget.Clone("github.com/AaronCQL/gitget", gitget.Config{})
if err != nil {
panic(err)
}
fmt.Printf(
"Cloned %v/%v (%v) into %v\n",
res.RepoOwner, res.RepoName, res.RepoFragment, res.TargetDirRel,
)
Click to show internal directories.
Click to hide internal directories.