From 7e06247c94519a9e84b4f23563430b4ace811dc5 Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Sat, 15 Jun 2024 11:53:33 +0200 Subject: [PATCH 1/3] Remove unused status --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ed6123c..759eeb0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ go-flags: a go library for parsing command line arguments ========================================================= -[![GoDoc](https://godoc.org/github.com/jessevdk/go-flags?status.png)](https://godoc.org/github.com/jessevdk/go-flags) [![Build Status](https://travis-ci.org/jessevdk/go-flags.svg?branch=master)](https://travis-ci.org/jessevdk/go-flags) [![Coverage Status](https://img.shields.io/coveralls/jessevdk/go-flags.svg)](https://coveralls.io/r/jessevdk/go-flags?branch=master) +[![GoDoc](https://godoc.org/github.com/jessevdk/go-flags?status.png)](https://godoc.org/github.com/jessevdk/go-flags) This library provides similar functionality to the builtin flag library of go, but provides much more functionality and nicer formatting. From the @@ -78,7 +78,7 @@ var opts struct { // Example of a map IntMap map[string]int `long:"intmap" description:"A map from string to int"` - + // Example of env variable Thresholds []int `long:"thresholds" default:"1" default:"2" env:"THRESHOLD_VALUES" env-delim:","` } From c573fc0a2fbbc56a40370c47d314a8162cb1aaf1 Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Sat, 15 Jun 2024 11:55:01 +0200 Subject: [PATCH 2/3] Update for main branch rename --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0ff3692..27e6e7d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,9 +5,9 @@ name: Go on: push: - branches: ["master"] + branches: ["main"] pull_request: - branches: ["master"] + branches: ["main"] jobs: build: From c02e333e441eb1187c25e6d689d769d499ec2a0b Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Sat, 15 Jun 2024 14:24:44 +0200 Subject: [PATCH 3/3] Revert "Minor cleanup unused parameter" This reverts commit 4eda719c013c9de01dff62fcf4c1543316e0a200. --- completion.go | 6 +++--- optstyle_other.go | 2 +- parser.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/completion.go b/completion.go index dc6a447..8ed61f1 100644 --- a/completion.go +++ b/completion.go @@ -188,8 +188,8 @@ func (c *completion) complete(args []string) []Completion { } if argumentIsOption(arg) { - _, optname, islong := stripOptionPrefix(arg) - optname, _, argument := splitOption(optname, islong) + prefix, optname, islong := stripOptionPrefix(arg) + optname, _, argument := splitOption(prefix, optname, islong) if argument == nil { var o *Option @@ -250,7 +250,7 @@ func (c *completion) complete(args []string) []Completion { } else if argumentStartsOption(lastarg) { // Complete the option prefix, optname, islong := stripOptionPrefix(lastarg) - optname, split, argument := splitOption(optname, islong) + optname, split, argument := splitOption(prefix, optname, islong) if argument == nil && !islong { rname, n := utf8.DecodeRuneInString(optname) diff --git a/optstyle_other.go b/optstyle_other.go index 2053db9..f84b697 100644 --- a/optstyle_other.go +++ b/optstyle_other.go @@ -43,7 +43,7 @@ func stripOptionPrefix(optname string) (prefix string, name string, islong bool) // splitOption attempts to split the passed option into a name and an argument. // When there is no argument specified, nil will be returned for it. -func splitOption(option string, islong bool) (string, string, *string) { +func splitOption(prefix string, option string, islong bool) (string, string, *string) { pos := strings.Index(option, "=") if (islong && pos >= 0) || (!islong && pos == 1) { diff --git a/parser.go b/parser.go index f3fb650..939dd7b 100644 --- a/parser.go +++ b/parser.go @@ -279,8 +279,8 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) { continue } - _, optname, islong := stripOptionPrefix(arg) - optname, _, argument := splitOption(optname, islong) + prefix, optname, islong := stripOptionPrefix(arg) + optname, _, argument := splitOption(prefix, optname, islong) if islong { err = p.parseLong(s, optname, argument)