Updates along with migrate function.

This commit is contained in:
Mr. Is 2016-08-02 07:11:05 -04:00
parent 3e6e6fb7b1
commit 57c2915dec
3 changed files with 22 additions and 17 deletions

View File

@ -15,16 +15,6 @@ import (
var limit string // max num results var limit string // max num results
var userName string var userName string
func getUserByName(userName string) (user *gogs.User, err error) {
user, err = GetClient().GetUserInfo(userName)
if err != nil {
fmt.Println(err)
return
}
return user, err
}
func searchRepos(uid, query, limit string) ([]*gogs.Repository, error) { func searchRepos(uid, query, limit string) ([]*gogs.Repository, error) {
client := &http.Client{} client := &http.Client{}

View File

@ -17,6 +17,7 @@ var repoCmd = &cobra.Command{
$ gogs repo new my-new-repo --private $ gogs repo new my-new-repo --private
$ gogs repo create my-new-repo --org=JustUsGuys $ gogs repo create my-new-repo --org=JustUsGuys
$ gogs repo list $ gogs repo list
$ gogs repo migrate ia/my-copy-cat https://github.com/gogits/gogs.git
$ gogs repo destroy ia my-new-repo $ gogs repo destroy ia my-new-repo
$ gogs repo destroy ia/my-new-repo $ gogs repo destroy ia/my-new-repo

View File

@ -1,16 +1,10 @@
// This sucker is really annoying. Gogs Client says that search is a thing.
// And it is, it does work.
// But... I can't find it in the package. It's just not there. I've looked.
// So this is a re-write of the respondering methods that are nonexported in
// the Gogs Client package. Here they're used exclusively (and tweaked a little, as such)
// for the search command.
// It's dumb. I know.
package cmd package cmd
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
@ -19,6 +13,26 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
) )
// Useful for getting dat uid.
func getUserByName(userName string) (user *gogs.User, err error) {
user, err = GetClient().GetUserInfo(userName)
if err != nil {
fmt.Println(err)
return
}
return user, err
}
// This sucker is really annoying. Gogs Client says that search is a thing.
// And it is, it does work.
// But... I can't find it in the package. It's just not there. I've looked.
// So this is a re-write of the respondering methods that are nonexported in
// the Gogs Client package. Here they're used exclusively (and tweaked a little, as such)
// for the search command.
// It's dumb. I know.
type expRes struct { type expRes struct {
Data []*gogs.Repository `json:"data"` Data []*gogs.Repository `json:"data"`
} }