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

Commit

Permalink
Merge branch 'ft-live-pipeline-view' of github.com:profclems/glab int…
Browse files Browse the repository at this point in the history
…o ft-live-pipeline-view
  • Loading branch information
profclems committed Aug 13, 2020
2 parents 90f4d8a + 2dcf715 commit e8fb131
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 27 deletions.
4 changes: 2 additions & 2 deletions commands/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func displayAllIssues(m []*gitlab.Issue) {
labels += " " + l + ","
}
labels = strings.Trim(labels, ", ")
if labels != ""{
if labels != "" {
labels = "(" + labels + ")"
}
var issueID string
Expand Down Expand Up @@ -64,6 +64,6 @@ var issueCmd = &cobra.Command{
}

func init() {
issueCmd.PersistentFlags().StringP("repo", "R","", "Select another repository using the OWNER/REPO format or the project ID. Supports group namespaces")
issueCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the OWNER/REPO format or the project ID. Supports group namespaces")
RootCmd.AddCommand(issueCmd)
}
2 changes: 1 addition & 1 deletion commands/issue_close.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var issueCloseCmd = &cobra.Command{
Short: `Close an issue`,
Long: ``,
Aliases: []string{"unsub"},
Args: cobra.ExactArgs(1),
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
if len(args) > 1 {
cmdErr(cmd, args)
Expand Down
10 changes: 5 additions & 5 deletions commands/issue_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ var issueViewCmd = &cobra.Command{
Short: `Display the title, body, and other information about an issue.`,
Long: ``,
Aliases: []string{"show"},
Args: cobra.ExactArgs(1),
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 || len(args) >1 {
if len(args) == 0 || len(args) > 1 {
cmdErr(cmd, args)
return
}
Expand All @@ -44,7 +44,7 @@ var issueViewCmd = &cobra.Command{
if err != nil {
er(err)
}
if err:= a.Run(); err != nil {
if err := a.Run(); err != nil {
er(err)
}
return
Expand All @@ -62,7 +62,7 @@ var issueViewCmd = &cobra.Command{
issue.Author.Username,
issue.Author.Name,
utils.PrettyTimeAgo(ago),
)
)
if issue.Description != "" {
issue.Description, _ = utils.RenderMarkdown(issue.Description)
fmt.Println(issue.Description)
Expand Down Expand Up @@ -141,7 +141,7 @@ var issueViewCmd = &cobra.Command{
},
}

func prettifyNilEmptyValues(value interface{}, defVal string) interface{} {
func prettifyNilEmptyValues(value interface{}, defVal string) interface{} {
if value == nil || value == "" {
return defVal
}
Expand Down
2 changes: 1 addition & 1 deletion commands/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ var labelCmd = &cobra.Command{
}

func init() {
labelCmd.PersistentFlags().StringP("repo", "R","", "Select another repository using the OWNER/REPO format. Supports group namespaces")
labelCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the OWNER/REPO format. Supports group namespaces")
RootCmd.AddCommand(labelCmd)
}
4 changes: 2 additions & 2 deletions commands/mr.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func displayAllMergeRequests(m []*gitlab.MergeRequest) {
} else {
mrID = color.Sprintf("<red>#%d</>", mr.IID)
}
table.AddRow(mrID, mr.Title, color.Sprintf("<cyan>(%s) ← (%s)</>",mr.TargetBranch, mr.SourceBranch))
table.AddRow(mrID, mr.Title, color.Sprintf("<cyan>(%s) ← (%s)</>", mr.TargetBranch, mr.SourceBranch))
}
fmt.Println(table)
} else {
Expand All @@ -55,6 +55,6 @@ var mrCmd = &cobra.Command{
}

func init() {
mrCmd.PersistentFlags().StringP("repo", "R","", "Select another repository using the OWNER/REPO format or the project ID. Supports group namespaces")
mrCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the OWNER/REPO format or the project ID. Supports group namespaces")
RootCmd.AddCommand(mrCmd)
}
10 changes: 5 additions & 5 deletions commands/mr_close.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
)

var mrCloseCmd = &cobra.Command{
Use: "close <id>",
Short: `Close merge requests`,
Long: ``,
Args: cobra.ExactArgs(1),
Run: closeMergeRequestState,
Use: "close <id>",
Short: `Close merge requests`,
Long: ``,
Args: cobra.ExactArgs(1),
Run: closeMergeRequestState,
}

func closeMergeRequestState(cmd *cobra.Command, args []string) {
Expand Down
2 changes: 1 addition & 1 deletion commands/mr_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var mrUpdateCmd = &cobra.Command{
Use: "update <id>",
Short: `Update merge requests`,
Long: ``,
Args: cobra.ExactArgs(1),
Args: cobra.ExactArgs(1),
Run: updateMergeRequest,
}

Expand Down
2 changes: 1 addition & 1 deletion commands/pipeline_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var pipelineDeleteCmd = &cobra.Command{
$ glab pipeline delete 12,34,2
`),
Long: ``,
Args: cobra.ExactArgs(1),
Args: cobra.ExactArgs(1),
Run: deletePipeline,
}

Expand Down
2 changes: 1 addition & 1 deletion commands/pipeline_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var pipelineListCmd = &cobra.Command{
$ glab pipeline list --state=failed
`),
Long: ``,
Args: cobra.ExactArgs(0),
Args: cobra.ExactArgs(0),
Run: listPipelines,
}

Expand Down
4 changes: 2 additions & 2 deletions commands/pipeline_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
)

var pipelineStatusCmd = &cobra.Command{
Use: "status [flags]",
Short: `View a running pipeline on current or other branch specified`,
Use: "status [flags]",
Short: `View a running pipeline on current or other branch specified`,
Aliases: []string{"stats"},
Example: heredoc.Doc(`
$ glab pipeline status --live
Expand Down
2 changes: 1 addition & 1 deletion commands/repo_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var repoArchiveCmd = &cobra.Command{
- namespace/group/repo
`),
Args: cobra.MaximumNArgs(2),
Run: func (cmd *cobra.Command, args []string) {
Run: func(cmd *cobra.Command, args []string) {
repo := config.GetRepo()
var name string
if len(args) != 0 {
Expand Down
2 changes: 1 addition & 1 deletion commands/repo_clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ var repoCloneCmd = &cobra.Command{

func init() {
repoCmd.AddCommand(repoCloneCmd)
}
}
6 changes: 3 additions & 3 deletions commands/repo_contributors.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ var repoContributorsCmd = &cobra.Command{
- namespace/repo
- namespace/group/repo
`),
Args: cobra.ExactArgs(0),
Args: cobra.ExactArgs(0),
Aliases: []string{"users"},
Run: func (cmd *cobra.Command, args []string) {
Run: func(cmd *cobra.Command, args []string) {
gitlabClient, repo := git.InitGitlabClient()
l := &gitlab.ListContributorsOptions{}
users, _, err := gitlabClient.Repositories.Contributors(repo, l)
Expand All @@ -42,4 +42,4 @@ func init() {
repoContributorsCmd.Flags().StringP("order", "f", "zip", "Return contributors ordered by name, email, or commits (orders by commit date) fields. Default is commits")
repoContributorsCmd.Flags().StringP("sort", "s", "", "Return contributors sorted in asc or desc order. Default is asc")
repoCmd.AddCommand(repoContributorsCmd)
}
}
3 changes: 2 additions & 1 deletion internal/config/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func ReadAndAppend(file, text string) {
log.Fatal(err)
}
}

// GetKeyValueInFile : returns env variable value
func GetKeyValueInFile(filePath, key string) string {
data, _ := ioutil.ReadFile(filePath)
Expand All @@ -40,4 +41,4 @@ func GetKeyValueInFile(filePath, key string) string {
line++
}
return "NOTFOUND"
}
}

0 comments on commit e8fb131

Please sign in to comment.