Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GitProviderCmd = &cobra.Command{ Use: "git-providers", Aliases: []string{"git-provider"}, Short: "Lists your registered Git providers", Run: func(cmd *cobra.Command, args []string) { apiClient, err := server.GetApiClient(nil) if err != nil { log.Fatal(err) } serverConfig, res, err := apiClient.ServerAPI.GetConfig(context.Background()).Execute() if err != nil { log.Fatal(apiclient.HandleErrorResponse(res, err)) } if len(serverConfig.GitProviders) == 0 { util.RenderInfoMessage("No git providers registered. Add a new git provider by preparing a Personal Access Token and running 'daytona git-providers add'") return } util.RenderMainTitle("Registered Git providers:") availableGitProviderViews := config.GetGitProviderList() var gitProviderViewList []config.GitProvider for _, gitProvider := range serverConfig.GitProviders { for _, availableGitProviderView := range availableGitProviderViews { if *gitProvider.Id == availableGitProviderView.Id { gitProviderViewList = append(gitProviderViewList, config.GitProvider{ Id: *gitProvider.Id, Name: availableGitProviderView.Name, Username: *gitProvider.Username, }, ) } } } if output.FormatFlag != "" { output.Output = gitProviderViewList return } for _, gitProviderView := range gitProviderViewList { util.RenderListLine(fmt.Sprintf("%s (%s)", gitProviderView.Name, gitProviderView.Username)) } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.