Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP argh mode #1792

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 24 additions & 1 deletion cli.go
Expand Up @@ -23,14 +23,19 @@
package cli

import (
"errors"
"fmt"
"os"
"runtime"
"sort"
"strings"
)

var (
isTracingOn = os.Getenv("URFAVE_CLI_TRACING") == "on"
Err = errors.New("urfave/cli error")

isTracingOn = os.Getenv("URFAVE_CLI_TRACING") == "on"
isArghModeOn = os.Getenv("URFAVE_CLI_ARGH_MODE") == "on"
)

func tracef(format string, a ...any) {
Expand Down Expand Up @@ -60,3 +65,21 @@
a...,
)
}

func stringMapToSlice[T any](m map[string]T) []T {
keys := []string{}

for key := range m {
keys = append(keys, key)
}

Check warning on line 74 in cli.go

View check run for this annotation

Codecov / codecov/patch

cli.go#L69-L74

Added lines #L69 - L74 were not covered by tests

sort.Strings(keys)

sl := []T{}

for _, key := range keys {
sl = append(sl, m[key])
}

Check warning on line 82 in cli.go

View check run for this annotation

Codecov / codecov/patch

cli.go#L76-L82

Added lines #L76 - L82 were not covered by tests

return sl

Check warning on line 84 in cli.go

View check run for this annotation

Codecov / codecov/patch

cli.go#L84

Added line #L84 was not covered by tests
}