diff --git a/README.md b/README.md
index 8a418fb..6c32e1d 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ Create a new API key under `User -> Settings -> Applications -> Generate New Tok
This key needs `repository` "Read and Write" access. Everything else can be left to "No Access".
## Usage
-`echo 'EXAMPLE_API_TOKEN' | ggv https://gitea.example.com myUsername myOutputOrganization`
+`echo 'EXAMPLE_API_TOKEN' | ggv https://gitea.example.com myOutputOrganization`
I recommend setting up a chron job or some form of automation for this. My deployment involves running this on my Gitea mirror (this server mirrors my main Gitea instance as well as my GitHub) weekly using a chron job, then my main Gitea instance mirrors the output repos from this tool.
diff --git a/main.go b/main.go
index 4753823..870c30b 100644
--- a/main.go
+++ b/main.go
@@ -34,16 +34,15 @@ type giteaRespT struct {
func main() {
// args
- if len(os.Args) < 3 {
- fmt.Println("Usage: " + os.Args[0] + " [output organization]\n\nAPI token can be piped into stdin to run non-interactively!")
+ if len(os.Args) < 2 {
+ fmt.Println("Usage: " + os.Args[0] + " [output organization]\n\nAPI token can be piped into stdin to run non-interactively!")
os.Exit(0)
}
baseURL := os.Args[1]
apiURL := baseURL + "/api/v1/repos/search?sort=updated&order=asc&limit=999"
- username := os.Args[2]
var organization string
- if len(os.Args) == 4 {
- organization = os.Args[3]
+ if len(os.Args) == 3 {
+ organization = os.Args[2]
}
fmt.Print("Input token: ")
token := back.ReadFromStdin()
@@ -168,7 +167,7 @@ repoLoop:
Force: true,
ClientOptions: []gitclient.Option{
gitclient.WithHTTPAuth(&githttp.BasicAuth{
- Username: username,
+ Username: "null",
Password: string(token),
}),
},