mirror of
https://github.com/gabrie30/ghorg.git
synced 2026-05-05 20:06:09 +02:00
Update how github users clone their own repos (#127)
This commit is contained in:
parent
21d74481cd
commit
86bd64d955
10
CHANGELOG.md
10
CHANGELOG.md
@ -2,6 +2,16 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
|
||||
## [1.6.0] - 4/9/21
|
||||
### Added
|
||||
### Changed
|
||||
- how github users clone their own repos thanks @dword-design
|
||||
### Deprecated
|
||||
### Removed
|
||||
### Fixed
|
||||
### Security
|
||||
|
||||
## [1.5.2] - 4/5/21
|
||||
### Added
|
||||
- ghorg clone me to clone all of your own private repos from github
|
||||
|
||||
14
cmd/clone.go
14
cmd/clone.go
@ -82,11 +82,6 @@ func cloneFunc(cmd *cobra.Command, argz []string) {
|
||||
|
||||
}
|
||||
|
||||
if len(argz) < 1 {
|
||||
colorlog.PrintError("You must provide an org or user to clone")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("path") {
|
||||
absolutePath := ensureTrailingSlash(cmd.Flag("path").Value.String())
|
||||
os.Setenv("GHORG_ABSOLUTE_PATH_TO_CLONE_TO", absolutePath)
|
||||
@ -156,6 +151,15 @@ func cloneFunc(cmd *cobra.Command, argz []string) {
|
||||
os.Setenv("GHORG_OUTPUT_DIR", d)
|
||||
}
|
||||
|
||||
if len(argz) < 1 {
|
||||
if os.Getenv("GHORG_SCM_TYPE") == "github" && os.Getenv("GHORG_CLONE_TYPE") == "user" {
|
||||
argz = append(argz, "")
|
||||
} else {
|
||||
colorlog.PrintError("You must provide an org or user to clone")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
configs.GetOrSetToken()
|
||||
|
||||
if cmd.Flags().Changed("token") {
|
||||
|
||||
@ -15,6 +15,6 @@ var versionCmd = &cobra.Command{
|
||||
Short: "Print the version number of Ghorg",
|
||||
Long: `All software has versions. This is Ghorg's`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("1.5.2")
|
||||
fmt.Println("1.6.0")
|
||||
},
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ GHORG_BRANCH:
|
||||
|
||||
# Type of entity to clone (user or org)
|
||||
# default: org
|
||||
# to clone all of your own repos from github use "ghorg clone me --clone-type=user"
|
||||
# to clone all of your own repos from github don't specify any user eg. "ghorg clone --clone-type=user"
|
||||
# flag (--clone-type, -c)
|
||||
GHORG_CLONE_TYPE:
|
||||
|
||||
|
||||
@ -80,10 +80,6 @@ func (c Github) GetUserRepos(targetUser string) ([]Repo, error) {
|
||||
|
||||
for {
|
||||
|
||||
if targetUser == "me" {
|
||||
targetUser = ""
|
||||
}
|
||||
|
||||
// List the repositories for a user. Passing the empty string will list repositories for the authenticated user.
|
||||
repos, resp, err := c.Repositories.List(context.Background(), targetUser, opt)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user