From 5ea0cb138bd4152724afa73909db508e73452fd1 Mon Sep 17 00:00:00 2001 From: Amine Date: Mon, 27 May 2019 20:26:36 +0200 Subject: [PATCH] Update documentation and function naming MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Michael Muré --- bridge/github/config.go | 7 +++---- bridge/launchpad/config.go | 5 ++++- commands/bridge_configure.go | 6 ++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bridge/github/config.go b/bridge/github/config.go index 2430de9c0f6395a3bfb3c67bf6610385266c728c..f44be47251291bcf0c5bb16b5144b7a7e4824efd 100644 --- a/bridge/github/config.go +++ b/bridge/github/config.go @@ -196,7 +196,7 @@ func promptTokenOptions(owner, project string) (string, error) { for { fmt.Println() fmt.Println("[0]: user provided token") - fmt.Println("[1]: automated token creation") + fmt.Println("[1]: interactive token creation") fmt.Print("Select option: ") line, err := bufio.NewReader(os.Stdin).ReadString('\n') @@ -258,7 +258,6 @@ func loginAndRequestToken(owner, project string) (string, error) { fmt.Println(" - 'repo:public_repo': to be able to read public repositories") fmt.Println("Private:") fmt.Println(" - 'repo' : to be able to read private repositories") - // fmt.Println("The token will have the \"repo\" permission, giving it read/write access to your repositories and issues. There is no narrower scope available, sorry :-|") fmt.Println() // prompt project visibility to know the token scope needed for the repository @@ -346,7 +345,7 @@ func promptUsername() (string, error) { } func promptURL(remotes map[string]string) (string, string, error) { - validRemotes := getValideGithubRemoteURLs(remotes) + validRemotes := getValidGithubRemoteURLs(remotes) if len(validRemotes) > 0 { for { fmt.Println("\nDetected projects:") @@ -419,7 +418,7 @@ func splitURL(url string) (shortURL string, owner string, project string, err er return res[0], res[1], res[2], nil } -func getValideGithubRemoteURLs(remotes map[string]string) []string { +func getValidGithubRemoteURLs(remotes map[string]string) []string { urls := make([]string, 0, len(remotes)) for _, url := range remotes { // split url can work again with shortURL diff --git a/bridge/launchpad/config.go b/bridge/launchpad/config.go index c5f72c019daf498758dd9728b3ee17216dbb74db..ef206fd5b108408c44b0edd74ce398fd023e0487 100644 --- a/bridge/launchpad/config.go +++ b/bridge/launchpad/config.go @@ -92,7 +92,10 @@ func promptProjectName() (string, error) { func validateProject(project string) (bool, error) { url := fmt.Sprintf("%s/%s", apiRoot, project) - resp, err := http.Get(url) + client := := &http.Client{ + Timeout: defaultTimeout, + } + resp, err := client.Get(url) if err != nil { return false, err } diff --git a/commands/bridge_configure.go b/commands/bridge_configure.go index f3f7f66fc070a552948e3baab1ca5badf443d40b..711ceb9c21f0318eef0044bca1c3972ba0215968 100644 --- a/commands/bridge_configure.go +++ b/commands/bridge_configure.go @@ -108,10 +108,8 @@ var bridgeConfigureCmd = &cobra.Command{ Use: "configure", Short: "Configure a new bridge.", Long: ` Configure a new bridge by passing flags or/and using interactive terminal prompts. You can avoid all the terminal prompts by passing all the necessary flags to configure your bridge. - Repository configuration can be made by passing or the --url flag or the --project and/or --owner flags. If the three flags are provided git-bug will use --project and --owner flags. - Token configuration can be made by passing it in the --token flag or in the terminal prompt. If you don't already have one you can use terminal prompt to login and generate it directly. - For Github and Gitlab bridges, git-bug need a token to export and import issues, comments and editions for public and private repositories. - For Launchpad bridges, git-bug for now supports only public repositories and you only need --project or --url flag to configure it.`, + Repository configuration can be made by passing either the --url flag or the --project and --owner flags. If the three flags are provided git-bug will use --project and --owner flags. + Token configuration can be directly passed with the --token flag or in the terminal prompt. If you don't already have one you can use the interactive procedure to generate one. Example: `# For Github git bug bridge configure \ --name=default \