Skip to content

Commit 8a6fe64

Browse files
committed
Bring fstail, gha-bump in-process via vendor
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent 23a5237 commit 8a6fe64

66 files changed

Lines changed: 3397 additions & 371 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/fstail/fstail.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright (c) arkade author(s) 2022. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
package fstail
5+
6+
import (
7+
"os"
8+
9+
"github.com/alexellis/fstail/pkg/fstail"
10+
"github.com/spf13/cobra"
11+
)
12+
13+
func MakeFstail() *cobra.Command {
14+
var prefixStyle string
15+
var disablePrefix bool
16+
17+
command := &cobra.Command{
18+
Use: "fstail [FLAGS] [PATH] [MATCH]",
19+
Short: "Tail files with optional string matching",
20+
Long: `Tail files in a directory with optional string matching and prefix styles.`,
21+
Example: ` arkade fstail
22+
arkade fstail /var/log/containers
23+
arkade fstail /var/log/containers "server error"
24+
arkade fstail --prefix k8s /var/log/containers
25+
arkade fstail --prefix none /var/log/containers`,
26+
Aliases: []string{"ft"},
27+
RunE: func(cmd *cobra.Command, args []string) error {
28+
var opts fstail.RunOptions
29+
30+
if len(args) == 1 {
31+
opts.WorkDir = args[0]
32+
} else if len(args) == 2 {
33+
opts.WorkDir = args[0]
34+
opts.Match = args[1]
35+
} else {
36+
cwd, err := os.Getwd()
37+
if err != nil {
38+
return err
39+
}
40+
opts.WorkDir = cwd
41+
}
42+
43+
opts.DisableLogPrefix = disablePrefix
44+
if disablePrefix {
45+
opts.PrefixStyle = fstail.PrefixStyleNone
46+
} else if prefixStyle == "k8s" {
47+
opts.PrefixStyle = fstail.PrefixStyleK8s
48+
} else {
49+
opts.PrefixStyle = fstail.PrefixStyleFilename
50+
}
51+
52+
return fstail.Run(opts)
53+
},
54+
}
55+
56+
command.Flags().StringVar(&prefixStyle, "prefix", "filename", "Prefix style: filename, k8s, or none")
57+
command.Flags().BoolVar(&disablePrefix, "no-prefix", false, "Disable prefix printing (equivalent to --prefix none)")
58+
59+
return command
60+
}

cmd/gha/gha.go

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package gha
22

33
import (
4+
"github.com/alexellis/gha-bump/pkg/ghabump"
45
"github.com/spf13/cobra"
56
)
67

@@ -10,15 +11,55 @@ func MakeGHA() *cobra.Command {
1011
Use: "gha",
1112
Short: "GitHub Actions utilities",
1213
Long: `Utilities for GitHub Actions workflows.`,
13-
Example: ` arkade gha upgrade --help`,
14+
Example: ` arkade gha bump --help`,
1415
SilenceUsage: true,
1516
}
1617

1718
command.RunE = func(cmd *cobra.Command, args []string) error {
1819
return cmd.Usage()
1920
}
2021

21-
command.AddCommand(MakeUpgrade())
22+
command.AddCommand(MakeBump())
23+
24+
return command
25+
}
26+
27+
func MakeBump() *cobra.Command {
28+
var command = &cobra.Command{
29+
Use: "bump",
30+
Short: "Upgrade actions in GitHub Actions workflow files to the latest major version",
31+
Aliases: []string{"u"},
32+
Long: `Upgrade actions in GitHub Actions workflow files to the latest major version.
33+
34+
Processes all workflow YAML files in .github/workflows/ or a single file.
35+
Only bumps major versions (e.g. actions/checkout@v3 to actions/checkout@v4).
36+
`,
37+
Example: ` # Upgrade all workflows in the current directory
38+
arkade gha bump
39+
40+
# Upgrade a single workflow file
41+
arkade gha bump -f .github/workflows/build.yaml
42+
43+
# Dry-run mode, don't write changes
44+
arkade gha bump --write=false`,
45+
SilenceUsage: true,
46+
}
47+
48+
command.Flags().StringP("file", "f", ".", "Path to workflow file or directory")
49+
command.Flags().BoolP("verbose", "v", true, "Verbose output")
50+
command.Flags().BoolP("write", "w", true, "Write the updated values back to the file")
51+
52+
command.RunE = func(cmd *cobra.Command, args []string) error {
53+
target, _ := cmd.Flags().GetString("file")
54+
verbose, _ := cmd.Flags().GetBool("verbose")
55+
write, _ := cmd.Flags().GetBool("write")
56+
57+
return ghabump.Run(ghabump.RunOptions{
58+
Target: target,
59+
Verbose: verbose,
60+
Write: write,
61+
})
62+
}
2263

2364
return command
2465
}

go.mod

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ require (
1919
gopkg.in/yaml.v3 v3.0.1
2020
)
2121

22+
require github.com/alexellis/gha-bump v0.0.0
23+
2224
require (
25+
github.com/alexellis/fstail v0.0.0-20250917111842-2ab578ec2afb
2326
github.com/clipperhouse/displaywidth v0.3.1 // indirect
2427
github.com/clipperhouse/stringish v0.1.1 // indirect
2528
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
@@ -29,7 +32,7 @@ require (
2932
github.com/docker/docker-credential-helpers v0.9.4 // indirect
3033
github.com/fatih/color v1.18.0 // indirect
3134
github.com/inconshreveable/mousetrap v1.1.0 // indirect
32-
github.com/klauspost/compress v1.18.3 // indirect
35+
github.com/klauspost/compress v1.18.4 // indirect
3336
github.com/mattn/go-colorable v0.1.14 // indirect
3437
github.com/mattn/go-runewidth v0.0.19 // indirect
3538
github.com/mitchellh/go-homedir v1.1.0 // indirect
@@ -44,4 +47,9 @@ require (
4447
github.com/vbatts/tar-split v0.12.2 // indirect
4548
golang.org/x/sync v0.18.0 // indirect
4649
golang.org/x/sys v0.40.0 // indirect
50+
gopkg.in/fsnotify.v1 v1.4.7 // indirect
4751
)
52+
53+
replace github.com/alexellis/fstail => ../fstail
54+
55+
replace github.com/alexellis/gha-bump => ../gha-bump

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4
2424
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
2525
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
2626
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
27+
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
28+
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
2729
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
2830
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
2931
github.com/google/go-containerregistry v0.20.7 h1:24VGNpS0IwrOZ2ms2P1QE3Xa5X9p4phx0aUgzYzHW6I=
3032
github.com/google/go-containerregistry v0.20.7/go.mod h1:Lx5LCZQjLH1QBaMPeGwsME9biPeo1lPx6lbGj/UmzgM=
3133
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
3234
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
35+
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=
36+
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
3337
github.com/klauspost/compress v1.18.3 h1:9PJRvfbmTabkOX8moIpXPbMMbYN60bWImDDU7L+/6zw=
3438
github.com/klauspost/compress v1.18.3/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
39+
github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c=
40+
github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
3541
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
3642
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
3743
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
@@ -91,6 +97,8 @@ golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
9197
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
9298
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
9399
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
100+
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
101+
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
94102
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
95103
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
96104
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/alexellis/arkade/cmd"
1010
"github.com/alexellis/arkade/cmd/chart"
1111
"github.com/alexellis/arkade/cmd/docker"
12+
"github.com/alexellis/arkade/cmd/fstail"
1213
"github.com/alexellis/arkade/cmd/gha"
1314
"github.com/alexellis/arkade/cmd/oci"
1415
"github.com/alexellis/arkade/cmd/system"
@@ -38,6 +39,7 @@ func main() {
3839

3940
rootCmd.AddCommand(chart.MakeChart())
4041
rootCmd.AddCommand(docker.MakeDocker())
42+
rootCmd.AddCommand(fstail.MakeFstail())
4143
rootCmd.AddCommand(gha.MakeGHA())
4244
rootCmd.AddCommand(system.MakeSystem())
4345
rootCmd.AddCommand(oci.MakeOci())

vendor/github.com/Masterminds/semver/doc.go

Lines changed: 52 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Masterminds/semver/version_fuzz.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/alexellis/fstail/LICENSE

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)