Skip to content

Commit 5e99d78

Browse files
committed
Updated makefile
1 parent 137cf4b commit 5e99d78

File tree

3 files changed

+14
-28
lines changed

3 files changed

+14
-28
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ BUILD_DIR := "build"
2222
CMD_DIR := $(filter-out cmd/ffmpeg/README.md, $(wildcard cmd/ffmpeg/*))
2323
BUILD_TAG := ${DOCKER_REGISTRY}/go-media-${OS}-${ARCH}:${VERSION}
2424

25-
all: clean cmds
25+
all: clean cli cmds
2626

2727
cmds: $(CMD_DIR)
2828

@@ -47,6 +47,11 @@ test: go-dep
4747
@${GO} test ./pkg/...
4848
@${GO} test .
4949

50+
51+
cli: go-dep mkdir
52+
@echo Build media tool
53+
@${GO} build ${BUILD_FLAGS} -o ${BUILD_DIR}/media ./cmd/cli
54+
5055
$(CMD_DIR): go-dep mkdir
5156
@echo Build cmd $(notdir $@)
5257
@${GO} build ${BUILD_FLAGS} -o ${BUILD_DIR}/$(notdir $@) ./$@

cmd/cli/version.go

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,18 @@
11
package main
22

33
import (
4-
"fmt"
54
"os"
6-
"runtime"
75

8-
"github.com/mutablelogic/go-client/pkg/version"
6+
"github.com/djthorpe/go-tablewriter"
7+
"github.com/mutablelogic/go-media"
98
)
109

1110
type VersionCmd struct{}
1211

1312
func (v *VersionCmd) Run(globals *Globals) error {
14-
w := os.Stdout
15-
if version.GitSource != "" {
16-
if version.GitTag != "" {
17-
fmt.Fprintf(w, " %v", version.GitTag)
18-
}
19-
if version.GitSource != "" {
20-
fmt.Fprintf(w, " (%v)", version.GitSource)
21-
}
22-
fmt.Fprintln(w, "")
13+
opts := []tablewriter.TableOpt{
14+
tablewriter.OptOutputText(),
15+
tablewriter.OptDelimiter(' '),
2316
}
24-
if runtime.Version() != "" {
25-
fmt.Fprintf(w, "%v %v/%v\n", runtime.Version(), runtime.GOOS, runtime.GOARCH)
26-
}
27-
if version.GitBranch != "" {
28-
fmt.Fprintf(w, "Branch: %v\n", version.GitBranch)
29-
}
30-
if version.GitHash != "" {
31-
fmt.Fprintf(w, "Hash: %v\n", version.GitHash)
32-
}
33-
if version.GoBuildTime != "" {
34-
fmt.Fprintf(w, "BuildTime: %v\n", version.GoBuildTime)
35-
}
36-
return nil
17+
return tablewriter.New(os.Stdout, opts...).Write(media.NewManager().Version())
3718
}

metadata.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import "encoding/json"
66
// TYPES
77

88
type metadata struct {
9-
Key string `json:"key"`
10-
Value any `json:"value"`
9+
Key string `json:"key" writer:",width:30"`
10+
Value any `json:"value" writer:",width:50"`
1111
}
1212

1313
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)