Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
fix: Use os.Args if contexts.WithOSArgs not called
Browse files Browse the repository at this point in the history
  • Loading branch information
ginokent committed Aug 12, 2024
1 parent 1aa36d4 commit 6814f85
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package config
import (
"context"
"encoding/json"
"os"
"sync"

errorz "github.com/kunitsucom/util.go/errors"
Expand Down Expand Up @@ -179,7 +180,11 @@ func load(ctx context.Context) (cfg *config, remainingArgs []string, err error)
},
}

remainingArgs, err = cmd.Parse(contexts.OSArgs(ctx))
osArgs := contexts.OSArgs(ctx)
if len(osArgs) == 0 {
osArgs = os.Args
}
remainingArgs, err = cmd.Parse(osArgs)
if err != nil {
return nil, nil, errorz.Errorf("cmd.Parse: %w", err)
}
Expand Down

0 comments on commit 6814f85

Please sign in to comment.