Skip to content

Commit

Permalink
Fix Snippets Browse cfg host
Browse files Browse the repository at this point in the history
Snippets could not get hostURL from cfg, mimicked the code from
mr_browse.

Signed-off-by: Lucas Zampieri <[email protected]>
  • Loading branch information
zampierilucas committed Jul 7, 2021
1 parent 20c4d18 commit fea9e83
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions cmd/snippet_browse.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package cmd

import (
lab "github.com/zaquestion/lab/internal/gitlab"
"net/url"
"path"
"strconv"

"github.com/rsteube/carapace"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/zaquestion/lab/internal/action"
)

Expand All @@ -21,18 +21,7 @@ var snippetBrowseCmd = &cobra.Command{
log.Fatal(err)
}

c := viper.AllSettings()["core"]
var cfg map[string]interface{}
switch v := c.(type) {
// Most run this is the type
case []map[string]interface{}:
cfg = v[0]
// On the first run when the cfg is created it comes in as this type
// for whatever reason
case map[string]interface{}:
cfg = v
}
host := cfg["host"].(string)
host := lab.Host()
hostURL, err := url.Parse(host)
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit fea9e83

Please sign in to comment.