Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #845 from addshore/mwcli-modifications
Browse files Browse the repository at this point in the history
feat: allow reuse of glab in other CLI contexts
  • Loading branch information
profclems authored Sep 27, 2021
2 parents c608850 + d5b819b commit ae6568e
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"time"

"github.com/profclems/glab/internal/config"
"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/pkg/glinstance"
"github.com/xanzy/go-gitlab"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/glab/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"github.com/profclems/glab/commands/help"
"github.com/profclems/glab/commands/update"
"github.com/profclems/glab/internal/config"
"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/internal/run"
"github.com/profclems/glab/pkg/glinstance"
"github.com/profclems/glab/pkg/tableprinter"
"github.com/profclems/glab/pkg/utils"

Expand Down
2 changes: 1 addition & 1 deletion commands/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/profclems/glab/commands/cmdutils"
"github.com/profclems/glab/internal/config"
"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/internal/glrepo"
"github.com/profclems/glab/pkg/glinstance"
"github.com/spf13/cobra"
jsonPretty "github.com/tidwall/pretty"
"github.com/xanzy/go-gitlab"
Expand Down
7 changes: 4 additions & 3 deletions commands/auth/login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/profclems/glab/api"
"github.com/profclems/glab/commands/cmdutils"
"github.com/profclems/glab/internal/config"
"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/pkg/glinstance"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -125,14 +125,15 @@ func loginRun() error {

hostname := opts.Hostname
apiHostname := opts.Hostname
defaultHostname := glinstance.OverridableDefault()
isSelfHosted := false

if hostname == "" {
var hostType int
err := survey.AskOne(&survey.Select{
Message: "What GitLab instance do you want to log into?",
Options: []string{
"GitLab.com",
defaultHostname,
"GitLab Self-hosted Instance",
},
}, &hostType)
Expand All @@ -143,7 +144,7 @@ func loginRun() error {

isSelfHosted = hostType == 1

hostname = glinstance.Default()
hostname = defaultHostname
apiHostname = hostname
if isSelfHosted {
err := survey.AskOne(&survey.Input{
Expand Down
2 changes: 1 addition & 1 deletion commands/auth/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/profclems/glab/api"
"github.com/profclems/glab/commands/cmdutils"
"github.com/profclems/glab/internal/config"
"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/pkg/glinstance"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion commands/cmdutils/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

"github.com/profclems/glab/api"
"github.com/profclems/glab/internal/config"
"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/internal/glrepo"
"github.com/profclems/glab/pkg/git"
"github.com/profclems/glab/pkg/glinstance"
"github.com/profclems/glab/pkg/iostreams"
"github.com/xanzy/go-gitlab"
)
Expand Down
2 changes: 1 addition & 1 deletion commands/cmdutils/remote_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"strings"

"github.com/profclems/glab/internal/config"
"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/internal/glrepo"
"github.com/profclems/glab/pkg/git"
"github.com/profclems/glab/pkg/glinstance"
)

type remoteResolver struct {
Expand Down
2 changes: 1 addition & 1 deletion commands/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/profclems/glab/commands/cmdutils"
"github.com/profclems/glab/internal/config"
"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/pkg/glinstance"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion commands/project/clone/repo_clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"github.com/profclems/glab/api"
"github.com/profclems/glab/commands/cmdutils"
"github.com/profclems/glab/internal/config"
"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/internal/glrepo"
"github.com/profclems/glab/pkg/git"
"github.com/profclems/glab/pkg/glinstance"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/xanzy/go-gitlab"
Expand Down
2 changes: 1 addition & 1 deletion commands/release/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"github.com/profclems/glab/pkg/surveyext"
"github.com/profclems/glab/pkg/utils"

"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/internal/glrepo"
"github.com/profclems/glab/pkg/glinstance"
"github.com/profclems/glab/pkg/iostreams"

"github.com/profclems/glab/commands/cmdutils"
Expand Down
2 changes: 1 addition & 1 deletion commands/release/releaseutils/releaseutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"strings"

"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/internal/glrepo"
"github.com/profclems/glab/pkg/glinstance"

"github.com/profclems/glab/commands/release/releaseutils/upload"

Expand Down
2 changes: 1 addition & 1 deletion commands/release/releaseutils/upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"io"

"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/pkg/glinstance"
"github.com/profclems/glab/pkg/iostreams"
"github.com/xanzy/go-gitlab"
)
Expand Down
2 changes: 1 addition & 1 deletion commands/release/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/profclems/glab/commands/cmdutils"
"github.com/profclems/glab/commands/release/releaseutils"
"github.com/profclems/glab/internal/config"
"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/internal/glrepo"
"github.com/profclems/glab/pkg/glinstance"
"github.com/profclems/glab/pkg/iostreams"
"github.com/profclems/glab/pkg/utils"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sort"
"strings"

"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/pkg/glinstance"

"errors"

Expand Down
2 changes: 1 addition & 1 deletion internal/glrepo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

"github.com/profclems/glab/internal/config"

"github.com/profclems/glab/internal/glinstance"
"github.com/profclems/glab/pkg/git"
"github.com/profclems/glab/pkg/glinstance"
"github.com/profclems/glab/pkg/utils"
"github.com/xanzy/go-gitlab"
)
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit ae6568e

Please sign in to comment.