Skip to content

Commit

Permalink
global token argument, upload checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tempor1s committed Mar 11, 2020
1 parent 3ce8c45 commit e024151
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
1 change: 0 additions & 1 deletion cmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

func init() {
rootCmd.AddCommand(downloadCommand)
downloadCommand.Flags().StringVarP(&Token, "token", "t", "", "Your personal access token. Needed to be able to clone private repos.")
}

// downloadCommand is the command register for backing up repos
Expand Down
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var rootCmd = &cobra.Command{
func Execute() {
// Global Flags
rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "Verbose output mode")
rootCmd.PersistentFlags().StringVarP(&Token, "token", "t", "", "Your personal access token. You need this to be able to upload your repos and clone private ones.")

// Execute Command
if err := rootCmd.Execute(); err != nil {
Expand Down
1 change: 0 additions & 1 deletion cmd/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

func init() {
rootCmd.AddCommand(uploadCommand)
downloadCommand.Flags().StringVarP(&Token, "token", "t", "", "Your personal access token. Needed to be able to upload to a repository...")
}

// uploadCommand is the command register for backing up repos
Expand Down
18 changes: 15 additions & 3 deletions upload/upload.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
package upload

import "fmt"
import (
"fmt"
)

// Start will start the upload process of all repos in the current directory
func Start(token string, args []string) {
fmt.Println("Placeholder")
fmt.Println(token)
if len(args) == 0 {
fmt.Println("Please pass the provider that you want to upload to. (github/gitlab) Example: `upload github`")
return
} else if len(args) == 1 {
fmt.Println("Please pass in the username that you would like to upload to. Example: `upload github tempor1s`")
return
}

if token == "" {
fmt.Println("For uploading to Github you need to provide a personal access token using --token. Example: `upload github tempor1s --token=123asd`")
return
}
}

// gitHub will allow you to upload all github repos in the current directory into the github repo that is associated with your personal access token
Expand Down

0 comments on commit e024151

Please sign in to comment.