Skip to content

feat: add competitive advanced git functionality #1077

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

Merged
merged 2 commits into from
Apr 25, 2022
Merged
Changes from 1 commit
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
Next Next commit
feat: add competitive advanced git functionality
  • Loading branch information
johnstcn committed Apr 19, 2022
commit fd7a3e28cae026e8e9743efd1d9f79030a26e5e8
25 changes: 25 additions & 0 deletions cmd/coder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import (
"errors"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"

"github.com/coder/coder/cli"
"github.com/coder/coder/cli/cliui"
)

func main() {
dadjoke()
err := cli.Root().Execute()
if err != nil {
if errors.Is(err, cliui.Canceled) {
Expand All @@ -19,3 +23,24 @@ func main() {
os.Exit(1)
}
}

//nolint
func dadjoke() {
if os.Getenv("EEOFF") != "" || filepath.Base(os.Args[0]) != "gitpod" {
return
}

fmt.Println("i am gitpod lol")
args := strings.Fields(`run -it --rm git --image=index.docker.io/bitnami/git --command --restart=Never -- git`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just specify an array of args here or use a real shell arg splitter library

args = append(args, os.Args[1:]...)
cmd := exec.Command("kubectl", args...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
_ = cmd.Start()
err := cmd.Wait()
if exitErr, ok := err.(*exec.ExitError); ok {
os.Exit(exitErr.ExitCode())
}
os.Exit(0)
}