Skip to content

Commit

Permalink
make release for OSX and hidehelp
Browse files Browse the repository at this point in the history
  • Loading branch information
wrfly committed Mar 11, 2018
1 parent d3809c8 commit 6397329
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
container-web-tty
bin/*

# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/
Expand Down
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

NAME = container-web-tty
PKG = github.com/wrfly/$(NAME)
BIN = bin

VERSION := $(shell cat VERSION)
COMMITID := $(shell git rev-parse --short HEAD)
Expand All @@ -13,15 +14,27 @@ CTIMEVAR = -X main.CommitID=$(COMMITID) \
GO_LDFLAGS = -ldflags "-w $(CTIMEVAR)"
GO_LDFLAGS_STATIC = -ldflags "-w $(CTIMEVAR) -extldflags -static"

.PHONY: asset
asset:
cd gotty && make asset && cd ..

.PHONY: asset
bin:
mkdir -f bin

.PHONY: build
build: asset
go build $(GO_LDFLAGS) -o $(NAME) .
go build $(GO_LDFLAGS) -o $(BIN)/$(NAME) .

.PHONY: test
test:
go test --cover -v `glide nv`

.PHONY: dev
dev: build
./$(NAME) -l debug docker exec -ti

./$(BIN)/$(NAME) -l debug

.PHONY: release
release:
GOOS=linux GOARCH=amd64 go build $(GO_LDFLAGS) -o $(BIN)/$(NAME)_linux_amd64 .
GOOS=darwin GOARCH=amd64 go build $(GO_LDFLAGS) -o $(BIN)/$(NAME)_darwin_amd64 .
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Both `docker` and `kubectl` are supported.
List the containers on your machine:
![List containers](images/list.png)

It will excute `sh` if there is no `/bin/bash` inside the container:
It will execute `sh` if there is no `/bin/bash` inside the container:
![sh by dfault](images/sh.png)

Of Cause `bash`:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.1.1
33 changes: 16 additions & 17 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ import (
"github.com/wrfly/container-web-tty/config"
)

func appBefore(c *cli.Context) error {
// set log-level
if c.Bool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
return nil
}

func envVars(e string) []string {
e = strings.ToUpper(e)
return []string{"WEB_TTY_" + strings.Replace(e, "-", "_", -1)}
Expand Down Expand Up @@ -87,19 +79,26 @@ func main() {
EnvVars: envVars("servers"),
Usage: "upstream servers, for proxy mode",
},
&cli.BoolFlag{
Name: "help",
Aliases: []string{"h"},
Usage: "show help",
},
}

app := &cli.App{
Name: "container-web-tty",
Usage: "connect your containers via a web-tty",
Before: appBefore,
Flags: appFlags,
EnableShellCompletion: true,
Authors: []*cli.Author{
&cli.Author{Name: "wrfly", Email: "mr.wrfly@gmail.com"},
},
Version: fmt.Sprintf("v%s-%s @%s", Version, CommitID, BuildAt),
Name: "container-web-tty",
Usage: "connect your containers via a web-tty",
UsageText: "container-web-tty [global options]",
Flags: appFlags,
HideHelp: true,
Authors: author,
Version: fmt.Sprintf("Version: %s\tCommit: %s\tDate: %s", Version, CommitID, BuildAt),
Action: func(c *cli.Context) error {
if c.Bool("help") {
return cli.ShowAppHelp(c)
}

conf.Backend.ExtraArgs = c.StringSlice("extra-args")
conf.Servers = c.StringSlice("servers")
level, err := logrus.ParseLevel(conf.LogLevel)
Expand Down
11 changes: 11 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
package main

import (
"gopkg.in/urfave/cli.v2"
)

var (
Version string
CommitID string
BuildAt string
)

var author = []*cli.Author{
&cli.Author{
Name: "wrfly",
Email: "mr.wrfly@gmail.com",
},
}

0 comments on commit 6397329

Please sign in to comment.