This commit is contained in:
Nuno Cruces 2021-04-14 15:18:05 +01:00
parent 2e8c2e1c22
commit 18f3259540
3 changed files with 4 additions and 8 deletions

View file

@ -177,7 +177,7 @@ func setupFlags() {
flag.BoolVar(&hideText, "hide-text", false, "Hide the entry text") flag.BoolVar(&hideText, "hide-text", false, "Hide the entry text")
// List options // List options
flag.Var(funcValue(addColumn), "column", "Set the column header") flag.Func("column", "Set the column header", addColumn)
flag.Bool("hide-header", true, "Hide the column headers") flag.Bool("hide-header", true, "Hide the column headers")
flag.BoolVar(&allowEmpty, "allow-empty", true, "Allow empty selection (macOS only)") flag.BoolVar(&allowEmpty, "allow-empty", true, "Allow empty selection (macOS only)")
@ -188,7 +188,7 @@ func setupFlags() {
flag.BoolVar(&confirmCreate, "confirm-create", false, "Confirm file selection if filename does not yet exist (Windows only)") flag.BoolVar(&confirmCreate, "confirm-create", false, "Confirm file selection if filename does not yet exist (Windows only)")
flag.BoolVar(&showHidden, "show-hidden", false, "Show hidden files (Windows and macOS only)") flag.BoolVar(&showHidden, "show-hidden", false, "Show hidden files (Windows and macOS only)")
flag.StringVar(&filename, "filename", "", "Set the `filename`") flag.StringVar(&filename, "filename", "", "Set the `filename`")
flag.Var(funcValue(addFileFilter), "file-filter", "Set a filename filter (NAME | PATTERN1 PATTERN2 ...)") flag.Func("file-filter", "Set a filename filter (NAME | PATTERN1 PATTERN2 ...)", addFileFilter)
// Color selection options // Color selection options
flag.StringVar(&defaultColor, "color", "", "Set the `color`") flag.StringVar(&defaultColor, "color", "", "Set the `color`")
@ -520,11 +520,6 @@ func egestPaths(paths []string, err error) ([]string, error) {
return paths, err return paths, err
} }
type funcValue func(string) error
func (f funcValue) String() string { return "" }
func (f funcValue) Set(s string) error { return f(s) }
func addColumn(s string) error { func addColumn(s string) error {
columns++ columns++
if columns <= 1 { if columns <= 1 {

2
go.mod
View file

@ -1,6 +1,6 @@
module github.com/ncruces/zenity module github.com/ncruces/zenity
go 1.15 go 1.16
require ( require (
github.com/dchest/jsmin v0.0.0-20160823214000-faeced883947 github.com/dchest/jsmin v0.0.0-20160823214000-faeced883947

1
go.sum
View file

@ -13,6 +13,7 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=