Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.0.9
v2.0.10
6 changes: 1 addition & 5 deletions alias_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func TestWithAlias(t *testing.T) {
figs.NewString(cmdLong, valueLong, usage)
figs.WithAlias(cmdLong, cmdAliasLong)
assert.NoError(t, figs.Parse())
t.Log(figs.Usage())

assert.Equal(t, valueLong, *figs.String(cmdLong))
assert.Equal(t, valueLong, *figs.String(cmdAliasLong))
Expand All @@ -33,7 +32,6 @@ func TestWithAlias(t *testing.T) {
figs.WithAlias(k, ka2)
figs.WithAlias(k, ka3)
assert.NoError(t, figs.Parse())
t.Log(figs.Usage())

assert.Equal(t, v, *figs.String(k))
assert.Equal(t, v, *figs.String(ka1))
Expand All @@ -56,7 +54,7 @@ func TestWithAlias(t *testing.T) {
figs.WithValidator(cmdShort, AssureStringNotEmpty)

assert.NoError(t, figs.Parse())
t.Log(figs.Usage())

// long
assert.Equal(t, valueLong, *figs.String(cmdLong))
assert.Equal(t, valueLong, *figs.String(cmdAliasLong))
Expand All @@ -73,7 +71,6 @@ func TestWithAlias(t *testing.T) {
figs.NewInt("count", 42, "usage")
figs.WithAlias("count", "c")
assert.NoError(t, figs.Parse())
t.Log(figs.Usage())
assert.Equal(t, 42, *figs.Int("count"))
assert.Equal(t, 42, *figs.Int("c"))
})
Expand All @@ -86,6 +83,5 @@ func TestWithAlias(t *testing.T) {
figs.WithAlias("two", "x") // Should this overwrite or be ignored?
assert.NoError(t, figs.Parse())
assert.Equal(t, "value1", *figs.String("x")) // Clarify expected behavior
t.Log(figs.Usage())
})
}
1 change: 1 addition & 0 deletions figtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func With(opts Options) Plant {
mutationsCh: make(chan Mutation),
flagSet: flag.NewFlagSet(os.Args[0], flag.ContinueOnError),
}
fig.flagSet.Usage = fig.Usage
angel.Store(false)
if opts.IgnoreEnvironment {
os.Clearenv()
Expand Down
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ type Core interface {
ErrorFor(name string) error

// Usage displays the helpful menu of figs registered using -h or -help
Usage() string
Usage()
}

// Plant defines the interface for configuration management.
Expand Down
4 changes: 2 additions & 2 deletions usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// Usage prints a helpful table of figs in a human-readable format
func (tree *figTree) Usage() string {
func (tree *figTree) Usage() {
termWidth := 80
if term.IsTerminal(int(os.Stdout.Fd())) {
if width, _, err := term.GetSize(int(os.Stdout.Fd())); err == nil {
Expand Down Expand Up @@ -79,7 +79,7 @@ func (tree *figTree) Usage() string {
}
})

return sb.String()
fmt.Println(sb.String())
}

// wrapText wraps a line of text to fit within the terminal width, indenting wrapped lines
Expand Down
Loading