From 1935ea5bc8295ead1f6e60152922d71ff6271074 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Sat, 18 Dec 2021 22:04:36 -0700 Subject: [PATCH] updates (#129) Signed-off-by: Brian Downs --- .travis.yml | 4 ++-- Makefile | 10 ++++++---- NOTICE.txt | 4 ++++ README.md | 7 +++++-- character_sets.go | 25 +++++++++++++++++++++++++ spinner.go | 5 ++++- spinner_test.go | 2 ++ 7 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 NOTICE.txt diff --git a/.travis.yml b/.travis.yml index 5a00f59..74d205a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ arch: - ppc64le language: go go: - - 1.13 - - 1.14.1 + - 1.16 + - 1.17.5 env: - GOARCH: amd64 - GOARCH: 386 diff --git a/Makefile b/Makefile index bf0b48a..3cfdeb2 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,11 @@ -GO = GO111MODULE=on GOFLAGS=-mod=vendor go +GO = go .PHONY: deps -deps: - $(GO) mod download - $(GO) mod vendor +deps: go.mod + +go.mod: + go mod init + go mod tidy .PHONY: test test: diff --git a/NOTICE.txt b/NOTICE.txt new file mode 100644 index 0000000..e72228e --- /dev/null +++ b/NOTICE.txt @@ -0,0 +1,4 @@ +Spinner +Copyright (c) 2021 Brian J. Downs +This product is licensed to you under the Apache 2.0 license (the "License"). You may not use this product except in compliance with the Apache 2.0 License. +This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. diff --git a/README.md b/README.md index ddae178..20b315f 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,9 @@ go get github.com/briandowns/spinner ``` ## Available Character Sets + +90 Character Sets. Some examples below: + (Numbered by their slice index) | index | character set | sample gif | @@ -151,7 +154,7 @@ You can specify both the background and foreground color, as well as additional s.Color("red", "bold") // Set the spinner color to a bold red ``` -Or to set the background to black, the foreground to a bold red: +To set the background to black, the foreground to a bold red: ```Go s.Color("bgBlack", "bold", "fgRed") @@ -159,7 +162,7 @@ s.Color("bgBlack", "bold", "fgRed") Below is the full color and attribute list: -``` +```Go // default colors red black diff --git a/character_sets.go b/character_sets.go index f0d74a8..9c8a98b 100644 --- a/character_sets.go +++ b/character_sets.go @@ -1,3 +1,17 @@ +// Copyright (c) 2021 Brian J. Downs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package spinner const ( @@ -25,6 +39,7 @@ var CharSets = map[int][]string{ 15: {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}, 16: {"▉", "▊", "▋", "▌", "▍", "▎", "▏", "▎", "▍", "▌", "▋", "▊", "▉"}, 17: {"■", "□", "▪", "▫"}, + 18: {"←", "↑", "→", "↓"}, 19: {"╫", "╪"}, 20: {"⇐", "⇖", "⇑", "⇗", "⇒", "⇘", "⇓", "⇙"}, @@ -86,6 +101,16 @@ var CharSets = map[int][]string{ 78: {"⠈⠁", "⠈⠑", "⠈⠱", "⠈⡱", "⢀⡱", "⢄⡱", "⢄⡱", "⢆⡱", "⢎⡱", "⢎⡰", "⢎⡠", "⢎⡀", "⢎⠁", "⠎⠁", "⠊⠁"}, 79: {"________", "-_______", "_-______", "__-_____", "___-____", "____-___", "_____-__", "______-_", "_______-", "________", "_______-", "______-_", "_____-__", "____-___", "___-____", "__-_____", "_-______", "-_______", "________"}, 80: {"|_______", "_/______", "__-_____", "___\\____", "____|___", "_____/__", "______-_", "_______\\", "_______|", "______\\_", "_____-__", "____/___", "___|____", "__\\_____", "_-______"}, + 81: {"□", "◱", "◧", "▣", "■"}, + 82: {"□", "◱", "▨", "▩", "■"}, + 83: {"░", "▒", "▓", "█"}, + 84: {"░", "█"}, + 85: {"⚪", "⚫"}, + 86: {"◯", "⬤"}, + 87: {"▱", "▰"}, + 88: {"➊", "➋", "➌", "➍", "➎", "➏", "➐", "➑", "➒", "➓"}, + 89: {"½", "⅓", "⅔", "¼", "¾", "⅛", "⅜", "⅝", "⅞"}, + 90: {"↞", "↟", "↠", "↡"}, } func init() { diff --git a/spinner.go b/spinner.go index 1464a61..7fc56f4 100644 --- a/spinner.go +++ b/spinner.go @@ -1,3 +1,5 @@ +// Copyright (c) 2021 Brian J. Downs +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -171,7 +173,7 @@ func validColor(c string) bool { // Spinner struct to hold the provided options. type Spinner struct { - mu *sync.RWMutex // + mu *sync.RWMutex Delay time.Duration // Delay is the speed of the indicator chars []string // chars holds the chosen character set Prefix string // Prefix is the text preppended to the indicator @@ -202,6 +204,7 @@ func New(cs []string, d time.Duration, options ...Option) *Spinner { for _, option := range options { option(s) } + return s } diff --git a/spinner_test.go b/spinner_test.go index be46487..cf3edfc 100644 --- a/spinner_test.go +++ b/spinner_test.go @@ -1,3 +1,5 @@ +// Copyright (c) 2021 Brian J. Downs +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at