Skip to content

Commit 7a1b5d4

Browse files
committed
add -t option
1 parent 2a0cf4b commit 7a1b5d4

File tree

6 files changed

+26
-17
lines changed

6 files changed

+26
-17
lines changed

cData.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import (
88
func buildCData(parsed string, appTrimName int) *commands.CommandData {
99
// Command data
1010
commandData := commands.CommandData{
11-
Command: parsed,
12-
Config: config,
13-
Yes: *appYes,
14-
Force: *appForce,
11+
Command: parsed,
12+
Config: config,
13+
Yes: *appYes,
14+
Force: *appForce,
15+
HideTitel: *appNoTitle,
1516
}
1617

1718
// Init cdata

commands/Jobs.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@ func (cData *CommandData) ListJobs(limit int) {
3535

3636
// Build header
3737
headingColor := color.New(color.FgHiGreen, color.Underline, color.Bold)
38-
header := []interface{}{headingColor.Sprint("ID"), headingColor.Sprint("Info")}
3938
var jobWithPos bool
40-
if hasJobWithPos(jobs.Jobs) {
41-
header = append(header, headingColor.Sprint("Pos"))
42-
jobWithPos = true
43-
}
44-
header = append(header, []interface{}{headingColor.Sprint("Job Type"), headingColor.Sprint("Upload Type"), headingColor.Sprint("Status"), headingColor.Sprint("Duration")}...)
4539

46-
table.AddRow(header...)
40+
if !cData.HideTitel {
41+
header := []interface{}{headingColor.Sprint("ID"), headingColor.Sprint("Info")}
42+
if hasJobWithPos(jobs.Jobs) {
43+
header = append(header, headingColor.Sprint("Pos"))
44+
jobWithPos = true
45+
}
46+
header = append(header, []interface{}{headingColor.Sprint("Job Type"), headingColor.Sprint("Upload Type"), headingColor.Sprint("Status"), headingColor.Sprint("Duration")}...)
47+
48+
table.AddRow(header...)
49+
}
4750

4851
// Fill table with data
4952
for _, job := range jobs.Jobs {

commands/cData.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type CommandData struct {
1616

1717
NoRedaction, OutputJSON bool
1818
Yes, Force, Quiet bool
19+
HideTitel bool
1920
}
2021

2122
// Init init CommandData

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ require (
1313
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
1414
github.com/davecgh/go-spew v1.1.1 // indirect
1515
github.com/fatih/color v1.9.0
16-
github.com/jinzhu/gorm v1.9.15 // indirect
16+
github.com/jinzhu/gorm v1.9.16 // indirect
17+
github.com/klauspost/compress v1.10.11 // indirect
1718
github.com/mattn/go-runewidth v0.0.9 // indirect
1819
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
1920
github.com/zalando/go-keyring v0.1.0
2021
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
21-
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1 // indirect
22+
golang.org/x/sys v0.0.0-20200819171115-d785dc25833f // indirect
2223
gopkg.in/alecthomas/kingpin.v2 v2.2.6
2324
gopkg.in/benweidig/cli-table.v2 v2.0.0-20180519085552-8b9fa48fb374
2425
)

go.sum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZ
4747
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
4848
github.com/jinzhu/gorm v1.9.14 h1:Kg3ShyTPcM6nzVo148fRrcMO6MNKuqtOUwnzqMgVniM=
4949
github.com/jinzhu/gorm v1.9.14/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
50-
github.com/jinzhu/gorm v1.9.15 h1:OdR1qFvtXktlxk73XFYMiYn9ywzTwytqe4QkuMRqc38=
51-
github.com/jinzhu/gorm v1.9.15/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
50+
github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
51+
github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
5252
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
5353
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
5454
github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M=
5555
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
5656
github.com/klauspost/compress v1.10.10 h1:a/y8CglcM7gLGYmlbP/stPE5sR3hbhFRUjCBfd/0B3I=
5757
github.com/klauspost/compress v1.10.10/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
58+
github.com/klauspost/compress v1.10.11 h1:K9z59aO18Aywg2b/WSgBaUX99mHy2BES18Cr5lBKZHk=
59+
github.com/klauspost/compress v1.10.11/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
5860
github.com/klauspost/pgzip v1.2.4 h1:TQ7CNpYKovDOmqzRHKxJh0BeaBI7UdQZYc6p7pMQh1A=
5961
github.com/klauspost/pgzip v1.2.4/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
6062
github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
@@ -104,8 +106,8 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
104106
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
105107
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo=
106108
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
107-
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1 h1:sIky/MyNRSHTrdxfsiUSS4WIAMvInbeXljJz+jDjeYE=
108-
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
109+
golang.org/x/sys v0.0.0-20200819171115-d785dc25833f h1:KJuwZVtZBVzDmEDtB2zro9CXkD9O0dpCv4o2LHbQIAw=
110+
golang.org/x/sys v0.0.0-20200819171115-d785dc25833f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
109111
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
110112
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
111113
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ var (
4141
// Global flags
4242
appYes = app.Flag("yes", "Skip confirmations").Short('y').Bool()
4343
appCfgFile = app.Flag("config", "the configuration file for the app").Envar(getEnVar(EnVarConfigFile)).Short('c').String()
44+
appNoTitle = app.Flag("no-title", "Don't show table titles").Short('t').Bool()
4445

4546
// File related flags
4647
appForce = app.Flag("force", "Forces an action").Short('f').Bool()

0 commit comments

Comments
 (0)