github_repo_c

package
v0.0.0-...-0e3b330 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var List = &cobra.Command{
	Use: "list",
	Run: func(cmd *cobra.Command, args []string) {
		account := input.Account()
		repositories := github.Repositories(account)

		for _, repo := range repositories {
			clog.Infof(" {{ %s/%s | blue }}", repo.Owner, repo.Name)
		}
	},
}
View Source
var Root = &cobra.Command{
	Use: "repo",
	Run: func(cmd *cobra.Command, args []string) {
		account := input.Account()
		repositories := github.Repositories(account)

		var repoMap = make(map[string]github.SimpleRepo)
		var repoNames []string

		for _, repo := range repositories {
			fullRepositoryName := repo.Owner + "/" + repo.Name
			repoMap[fullRepositoryName] = repo
			repoNames = append(repoNames, fullRepositoryName)
		}

		_, selectedRepository := prompt.Select("Select a repository", repoNames)

		items := GetActions(selectedRepository)
		_, selectedAction := prompt.Select("Select an action", items)

		switch selectedAction {
		case openCode:
			shell.RunCmd(".", false, "code", ".")
		case openGitHub:
			shell.RunCmd(".", false, "open", repoMap[selectedRepository].Url)
		}
	},
}

Functions

func GetActions

func GetActions(repo string) []string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL