Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git command warning #630

Merged
merged 1 commit into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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