Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 6 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches: [ "*" ]

env:
GO_VERSION: "1.21"
GO_VERSION: "1.26"

jobs:

Expand All @@ -29,7 +29,7 @@ jobs:

# step 2: Set up go
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:

# step 8: Upload results
- name: Upload test results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}
path: coverage-${{ matrix.os }}.txt
Expand All @@ -78,7 +78,7 @@ jobs:

# step 2: Set up go
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

Expand All @@ -91,7 +91,7 @@ jobs:

# step 4: Download results
- name: Download test results
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: data/coverage/

Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

Expand Down
2 changes: 1 addition & 1 deletion commands/alias/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/0xcfff/hostsctl/hosts/dom"
"github.com/0xcfff/hostsctl/iptools"
"github.com/spf13/cobra"
"golang.org/x/exp/slices"
"slices"
)

type AliasAddOptions struct {
Expand Down
7 changes: 4 additions & 3 deletions commands/alias/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"encoding/json"
"fmt"
"io"
"maps"
"slices"
"strings"

"github.com/0xcfff/hostsctl/commands/common"
Expand All @@ -12,7 +14,6 @@ import (
"github.com/0xcfff/hostsctl/iotools"
"github.com/0xcfff/hostsctl/iptools"
"github.com/spf13/cobra"
"golang.org/x/exp/maps"
"gopkg.in/yaml.v3"
)

Expand Down Expand Up @@ -71,8 +72,8 @@ func NewCmdAliasList() *cobra.Command {
}

cmd.Flags().BoolVar(&opt.noHeaders, "no-headers", opt.noHeaders, "Disable printing headers")
cmd.Flags().StringVarP(&opt.output, "output", "o", opt.output, fmt.Sprintf("Output format. One of %s", strings.Join(maps.Keys(formats), ",")))
cmd.Flags().StringVarP(&opt.arrange, "arrange", "a", opt.arrange, fmt.Sprintf("IPs output grouping. One of %s.", strings.Join(maps.Keys(groupings), ",")))
cmd.Flags().StringVarP(&opt.output, "output", "o", opt.output, fmt.Sprintf("Output format. One of %s", strings.Join(slices.Sorted(maps.Keys(formats)), ",")))
cmd.Flags().StringVarP(&opt.arrange, "arrange", "a", opt.arrange, fmt.Sprintf("IPs output grouping. One of %s.", strings.Join(slices.Sorted(maps.Keys(groupings)), ",")))

return cmd
}
Expand Down
2 changes: 1 addition & 1 deletion commands/alias/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"

"github.com/0xcfff/hostsctl/hosts/dom"
"golang.org/x/exp/slices"
"slices"
)

type AliasModel struct {
Expand Down
2 changes: 1 addition & 1 deletion commands/block/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/0xcfff/hostsctl/hosts"
"github.com/0xcfff/hostsctl/hosts/dom"
"github.com/spf13/cobra"
"golang.org/x/exp/slices"
"slices"
)

type BlockDeleteOptions struct {
Expand Down
5 changes: 3 additions & 2 deletions commands/block/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"encoding/json"
"fmt"
"io"
"maps"
"slices"
"strconv"
"strings"

Expand All @@ -12,7 +14,6 @@ import (
"github.com/0xcfff/hostsctl/hosts/dom"
"github.com/0xcfff/hostsctl/iotools"
"github.com/spf13/cobra"
"golang.org/x/exp/maps"
"gopkg.in/yaml.v3"
)

Expand Down Expand Up @@ -60,7 +61,7 @@ func NewCmdBlockList() *cobra.Command {
}

cmd.Flags().BoolVar(&opt.noHeaders, "no-headers", opt.noHeaders, "Disable printing headers")
cmd.Flags().StringVarP(&opt.output, "output", "o", opt.output, fmt.Sprintf("Output format. One of %s", strings.Join(maps.Keys(formats), ",")))
cmd.Flags().StringVarP(&opt.output, "output", "o", opt.output, fmt.Sprintf("Output format. One of %s", strings.Join(slices.Sorted(maps.Keys(formats)), ",")))

return cmd
}
Expand Down
2 changes: 1 addition & 1 deletion commands/block/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type BlockModel struct {
Name string `json:"name" yaml:"name"`
Comment string `json:"comment,omitempty" yaml:"comment,omitempty"`
AliasesCount int `json:"count,omitempty" yaml:"count,omitempty"`
SystemAliasesCount int `json:"-" yaml:"-"`
SystemAliasesCount int `json:"-" yaml:"-"`
}

func NewBlocksModels(doc *dom.Document) []*BlockModel {
Expand Down
24 changes: 10 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
module github.com/0xcfff/hostsctl

go 1.20
go 1.26

require (
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.5.0
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
github.com/spf13/cobra v1.10.2
)

require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/pflag v1.0.9 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.9.2
github.com/stretchr/testify v1.8.0
golang.org/x/exp v0.0.0-20221002003631-540bb7301a08
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
github.com/spf13/afero v1.15.0
github.com/stretchr/testify v1.12.0
golang.org/x/text v0.41.0 // indirect
gopkg.in/yaml.v3 v3.0.1
)
Loading
Loading