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

Commit

Permalink
refactor: align display
Browse files Browse the repository at this point in the history
  • Loading branch information
profclems committed Aug 12, 2020
2 parents eb8b69a + 38f4e74 commit 11aecc7
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions commands/pipeline_status.go
Expand Up @@ -15,7 +15,7 @@ import (

var pipelineStatusCmd = &cobra.Command{
Use: "status [flags]",
Short: `View a running pipeline on `,
Short: `View a running pipeline on current or other branch specified`,
Aliases: []string{"stats"},
Example: heredoc.Doc(`
$ glab pipeline status --live
Expand All @@ -39,9 +39,9 @@ var pipelineStatusCmd = &cobra.Command{
}
}
l := &gitlab.ListProjectPipelinesOptions{
Ref: gitlab.String(branch),
Ref: gitlab.String(branch),
OrderBy: gitlab.String("updated_at"),
Sort: gitlab.String("desc"),
Sort: gitlab.String("desc"),
}
l.Page = 1
l.PerPage = 1
Expand All @@ -63,7 +63,7 @@ var pipelineStatusCmd = &cobra.Command{
for _, job := range jobs {
duration := fmtDuration(job.Duration)
var status string
switch s:=job.Status; s {
switch s := job.Status; s {
case "failed":
status = color.Red.Sprint(s)
case "success":
Expand Down Expand Up @@ -117,7 +117,7 @@ func retryPipelineJob(pid int) *gitlab.Pipeline {

func fmtDuration(duration float64) string {
s := math.Mod(duration, 60)
m := (duration-s)/60
m := (duration - s) / 60
s = math.Round(s)
return fmt.Sprintf("%02vm %02vs", m, s)
}
Expand All @@ -144,4 +144,4 @@ func init() {
pipelineStatusCmd.Flags().BoolP("live", "l", false, "Show status in realtime till pipeline ends")
pipelineStatusCmd.Flags().StringP("branch", "b", "", "Check pipeline status for a branch. (Default is current branch)")
pipelineCmd.AddCommand(pipelineStatusCmd)
}
}
14 changes: 7 additions & 7 deletions commands/pipeline_view.go
Expand Up @@ -30,7 +30,7 @@ var pipelineDetails *gitlab.Pipeline
var pipelineJobDetails []*gitlab.Job
var mainView *gocui.View

func getPipelineJobs(pid int) []*gitlab.Job {
func getPipelineJobs(pid int) []*gitlab.Job {
gitlabClient, repo := git.InitGitlabClient()
l := &gitlab.ListJobsOptions{}
pipeJobs, _, err := gitlabClient.Jobs.ListPipelineJobs(repo, pid, l)
Expand Down Expand Up @@ -173,10 +173,10 @@ func keybindings(g *gocui.Gui) error {
return err
}
/*
if err := g.SetKeybinding("side", gocui.KeyEnter, gocui.ModNone, getLine); err != nil {
return err
}
*/
if err := g.SetKeybinding("side", gocui.KeyEnter, gocui.ModNone, getLine); err != nil {
return err
}
*/
if err := g.SetKeybinding("side", gocui.KeyEnter, gocui.ModNone, showLoading); err != nil {
return err
}
Expand Down Expand Up @@ -271,7 +271,7 @@ func displayPipelineJobLog(g *gocui.Gui, jid int, maxX, maxY int) error {
return nil
}

func updatePipelineLog(v *gocui.View, jid int) {
func updatePipelineLog(v *gocui.View, jid int) {
var str string
if b, err := ioutil.ReadAll(getPipelineJobLog(jid)); err == nil {
str = string(b)
Expand All @@ -283,4 +283,4 @@ func updatePipelineLog(v *gocui.View, jid int) {

func init() {
pipelineCmd.AddCommand(pipelineViewCmd)
}
}
2 changes: 1 addition & 1 deletion internal/browser/browser.go
Expand Up @@ -51,4 +51,4 @@ func FromLauncher(launcher, url string) (*exec.Cmd, error) {
cmd := exec.Command(args[0], args[1:]...)
cmd.Stderr = os.Stderr
return cmd, nil
}
}
3 changes: 2 additions & 1 deletion internal/git/git.go
Expand Up @@ -36,7 +36,7 @@ func GetRemoteURL() string {
}

func GetRemoteBaseURL() string {
return strings.TrimSuffix(strings.ReplaceAll(GetRemoteURL(), GetRepo(), ""),".git")
return strings.TrimSuffix(strings.ReplaceAll(GetRemoteURL(), GetRepo(), ""), ".git")
}

// getRepoNameWithNamespace returns the the repo with its namespace (like profclems/glab). Respects group and subgroups names
Expand Down Expand Up @@ -65,6 +65,7 @@ func getRepoNameWithNamespace(remoteURL string) (string, error) {

// HasHub is true if hub binary is installed
var HasHub bool

// HasGH is true is GitHub Cli is installed
var HasGH bool

Expand Down
2 changes: 1 addition & 1 deletion internal/utils/utils.go
Expand Up @@ -106,4 +106,4 @@ func DisplayURL(urlStr string) string {

func GreenCheck() string {
return color.Green.Sprintf("✓")
}
}
1 change: 0 additions & 1 deletion log.txt

This file was deleted.

0 comments on commit 11aecc7

Please sign in to comment.