From 5204cc85be9c715b8793fc73bc9611e123f02033 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Wed, 29 Jan 2020 16:45:40 +0000 Subject: [PATCH] Improved documentation. --- cmd/zenity/main.go | 3 +++ internal/zenutil/color.go | 2 ++ internal/zenutil/env_darwin.go | 14 ++++++++++---- internal/zenutil/env_unix.go | 14 ++++++++++---- internal/zenutil/env_windows.go | 14 ++++++++++---- internal/zenutil/run_darwin.go | 1 + internal/zenutil/run_unix.go | 1 + 7 files changed, 37 insertions(+), 12 deletions(-) diff --git a/cmd/zenity/main.go b/cmd/zenity/main.go index 71640ad..a274567 100644 --- a/cmd/zenity/main.go +++ b/cmd/zenity/main.go @@ -374,14 +374,17 @@ func egestPaths(paths []string, err error) ([]string, error) { return paths, err } +// FileFilters is internal. type FileFilters struct { zenity.FileFilters } +// String is internal. func (f *FileFilters) String() string { return "zenity.FileFilters" } +// Set is internal. func (f *FileFilters) Set(s string) error { var filter zenity.FileFilter diff --git a/internal/zenutil/color.go b/internal/zenutil/color.go index 7e90ed8..366de9f 100644 --- a/internal/zenutil/color.go +++ b/internal/zenutil/color.go @@ -8,6 +8,7 @@ import ( "golang.org/x/image/colornames" ) +// ParseColor is internal. func ParseColor(s string) color.Color { if len(s) == 4 || len(s) == 5 { c := color.NRGBA{A: 0xf} @@ -46,6 +47,7 @@ func ParseColor(s string) color.Color { return nil } +// UnparseColor is internal. func UnparseColor(c color.Color) string { n := color.NRGBAModel.Convert(c).(color.NRGBA) if n.A == 255 { diff --git a/internal/zenutil/env_darwin.go b/internal/zenutil/env_darwin.go index 0251d26..fd9fdda 100644 --- a/internal/zenutil/env_darwin.go +++ b/internal/zenutil/env_darwin.go @@ -1,7 +1,13 @@ package zenutil -const LineBreak = "\n" +// These are internal. +const ( + LineBreak = "\n" +) -var Command bool -var Timeout int -var Separator = "\x00" +// These are internal. +var ( + Command bool + Timeout int + Separator = "\x00" +) diff --git a/internal/zenutil/env_unix.go b/internal/zenutil/env_unix.go index e2bdade..154e71e 100644 --- a/internal/zenutil/env_unix.go +++ b/internal/zenutil/env_unix.go @@ -3,8 +3,14 @@ // Package zenutil is internal. DO NOT USE. package zenutil -const LineBreak = "\n" +// These are internal. +const ( + LineBreak = "\n" +) -var Command bool -var Timeout int -var Separator = "\x1e" +// These are internal. +var ( + Command bool + Timeout int + Separator = "\x1e" +) diff --git a/internal/zenutil/env_windows.go b/internal/zenutil/env_windows.go index 6bd4c22..ee0957a 100644 --- a/internal/zenutil/env_windows.go +++ b/internal/zenutil/env_windows.go @@ -1,7 +1,13 @@ package zenutil -const LineBreak = "\r\n" +// These are internal. +const ( + LineBreak = "\r\n" +) -var Command bool -var Timeout int -var Separator string +// These are internal. +var ( + Command bool + Timeout int + Separator string +) diff --git a/internal/zenutil/run_darwin.go b/internal/zenutil/run_darwin.go index 7d02df4..0c24522 100644 --- a/internal/zenutil/run_darwin.go +++ b/internal/zenutil/run_darwin.go @@ -8,6 +8,7 @@ import ( "syscall" ) +// Run is internal. func Run(ctx context.Context, script string, data interface{}) ([]byte, error) { var buf strings.Builder diff --git a/internal/zenutil/run_unix.go b/internal/zenutil/run_unix.go index 43c7f92..c378a6f 100644 --- a/internal/zenutil/run_unix.go +++ b/internal/zenutil/run_unix.go @@ -22,6 +22,7 @@ func init() { tool = "zenity" } +// Run is internal. func Run(ctx context.Context, args []string) ([]byte, error) { if Command && path != "" { if Timeout > 0 {