Skip to content

Commit

Permalink
lab: Update lab's description
Browse files Browse the repository at this point in the history
lab is a command line utility for GitLab.  It does wrap around git
currently, however, that isn't lab's primary purpose.

Update lab's description.

Additional fix: Remove some dead code.
Additional fix: Warn git wrapper users that git wrap functionality will
eventually be removed.

Signed-off-by: Prarit Bhargava <[email protected]>
  • Loading branch information
prarit committed Mar 10, 2021
1 parent c79e750 commit 73fd2bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 3 additions & 8 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
// RootCmd represents the base command when called without any subcommands
var RootCmd = &cobra.Command{
Use: "lab",
Short: "A Git Wrapper for GitLab",
Short: "lab: A GitLab Command Line Interface Utility",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
if ok, err := cmd.Flags().GetBool("version"); err == nil && ok {
Expand Down Expand Up @@ -76,13 +76,6 @@ func helpFunc(cmd *cobra.Command, args []string) {
}
return
}

formatChar := "\n"
git := git.New()
git.Stdout = nil
git.Stderr = nil
usage, _ := git.CombinedOutput()
fmt.Printf("%s%sThese GitLab commands are provided by lab:\n%s\n\n", string(usage), formatChar, labUsageFormat(cmd.Root()))
}

var helpCmd = &cobra.Command{
Expand Down Expand Up @@ -206,6 +199,7 @@ func Execute() {
}

// Passthrough to git for any unrecognized commands
log.Println("Warning: lab's git passthrough command support will be removed in a later release.")
err = git.New(os.Args[1:]...).Run()
if exiterr, ok := err.(*exec.ExitError); ok {
if status, ok := exiterr.Sys().(syscall.WaitStatus); ok {
Expand All @@ -228,6 +222,7 @@ func Execute() {
}
}
if !knownFlag {
log.Println("Warning: lab's git passthrough command support will be removed in a later release.")
git.New(os.Args[1:]...).Run()
return
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestRootNoArg(t *testing.T) {
t.Log(string(b))
t.Fatal(err)
}
assert.Contains(t, string(b), `A Git Wrapper for GitLab
assert.Contains(t, string(b), `lab: A GitLab Command Line Interface Utility
Usage:
lab [flags]
Expand Down

0 comments on commit 73fd2bc

Please sign in to comment.