Skip to content

Commit

Permalink
Merge pull request #480 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 12.127.0
  • Loading branch information
andyone authored Jun 21, 2024
2 parents 01555d4 + 11c5465 commit 5e15e9e
Show file tree
Hide file tree
Showing 15 changed files with 214 additions and 79 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ updates:
- "andyone"
reviewers:
- "andyone"
groups:
all:
applies-to: version-updates
update-types:
- "minor"
- "patch"

- package-ecosystem: "github-actions"
directory: "/"
Expand Down
1 change: 1 addition & 0 deletions .github/images/card.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .github/images/godoc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .github/images/license.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## Changelog

### [12.127.0](https://kaos.sh/ek/12.127.0)

- `[options]` Added method `Delete`
- `[usage]` Added support for optional arguments to usage info
- `[uuid]` Added [UUID7](https://uuid7.com) generator
- `[options]` Code refactoring

### [12.126.1](https://kaos.sh/ek/12.126.1)

- `[usage]` Added `Info.WrapLen` option for text wrapping configuration
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<p align="center"><a href="#readme"><img src="https://gh.kaos.st/go-ek.svg"/></a></p>
<p align="center"><a href="#readme"><img src=".github/images/card.svg"/></a></p>

<p align="center">
<a href="https://kaos.sh/g/ek.v12"><img src="https://gh.kaos.st/godoc.svg" alt="PkgGoDev"></a>
<a href="https://kaos.sh/g/ek.v12"><img src=".github/images/godoc.svg"/></a>
<a href="https://kaos.sh/r/ek.v12"><img src="https://kaos.sh/r/ek.v12.svg" alt="GoReportCard" /></a>
<a href="https://kaos.sh/l/ek"><img src="https://kaos.sh/l/210cafc2de7bf4320649.svg" alt="Code Climate Maintainability" /></a>
<a href="https://kaos.sh/b/ek"><img src="https://kaos.sh/b/3649d737-e5b9-4465-9765-b9f4ebec60ec.svg" alt="Codebeat badge" /></a>
<br/>
<a href="https://kaos.sh/w/ek/ci"><img src="https://kaos.sh/w/ek/ci.svg" alt="GitHub Actions CI Status" /></a>
<a href="https://kaos.sh/w/ek/codeql-analysis"><img src="https://kaos.sh/w/ek/codeql-analysis.svg" alt="GitHub Actions CodeQL Status" /></a>
<a href="#license"><img src="https://gh.kaos.st/apache2.svg" /></a>
<a href="#license"><img src=".github/images/license.svg"/></a>
</p>

<p align="center"><a href="#platform-support">Platform support</a> • <a href="#sub-packages">Sub-packages</a> • <a href="#projects-with-ek">Projects with EK</a> • <a href="#ci-status">CI Status</a> • <a href="#contributing">Contributing</a> • <a href="#license">License</a></p>
Expand Down
2 changes: 1 addition & 1 deletion ek.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
// ////////////////////////////////////////////////////////////////////////////////// //

// VERSION is current ek package version
const VERSION = "12.126.1"
const VERSION = "12.127.0"

// ////////////////////////////////////////////////////////////////////////////////// //

Expand Down
40 changes: 40 additions & 0 deletions options/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@ func ExampleHas() {
fmt.Printf("Has lines option: %t\n", Has("l:lines"))
}

func ExampleDelete() {
args, _ := Parse(Map{
"u:user": {Type: STRING, Value: "john"},
"l:lines": {Type: INT, Min: 1, Max: 100},
"p:password": {},
})

// Remove password option after usage
Delete("p:password")

fmt.Printf("Arguments: %v\n", args)
fmt.Printf("Has password option: %t\n", Has("p:password"))
}

func ExampleFormat() {
o := "t:test"

Expand Down Expand Up @@ -418,6 +432,32 @@ func ExampleOptions_Has() {
// Has lines option: false
}

func ExampleOptions_Delete() {
opts := NewOptions()

// Add options
opts.AddMap(Map{
"u:user": {Type: STRING, Value: "john"},
"l:lines": {Type: INT, Min: 1, Max: 100},
"p:password": {},
})

input := "-u bob -p Test1234 file.txt"
args, _ := opts.Parse(strings.Split(input, " "))

opts.Delete("p:password")

fmt.Printf("Arguments: %v\n", args)
fmt.Printf("Has user option: %t\n", opts.Has("u:user"))
fmt.Printf("Has lines option: %t\n", opts.Has("l:lines"))
fmt.Printf("Has password option: %t\n", opts.Has("p:password"))
// Output:
// Arguments: [file.txt]
// Has user option: true
// Has lines option: false
// Has password option: false
}

func ExampleOptions_Parse() {
opts := NewOptions()

Expand Down
Loading

0 comments on commit 5e15e9e

Please sign in to comment.