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

make myip command not cache by default #114

Merged
merged 3 commits into from
Jul 20, 2022
Merged
Changes from 1 commit
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
10 changes: 6 additions & 4 deletions ipinfo/cmd_myip.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var completionsMyIP = &complete.Command{
Flags: map[string]complete.Predictor{
"-t": predict.Nothing,
"--token": predict.Nothing,
"--nocache": predict.Nothing,
"--cache": predict.Nothing,
"-h": predict.Nothing,
"--help": predict.Nothing,
"-f": predict.Set(coreFields),
Expand All @@ -37,8 +37,8 @@ Options:
General:
--token <tok>, -t <tok>
use <tok> as API token.
--nocache
do not use the cache.
--cache
use the cache.
--help, -h
show help.

Expand Down Expand Up @@ -68,7 +68,7 @@ func cmdMyIP() error {
var fCSV bool

pflag.StringVarP(&fTok, "token", "t", "", "the token to use.")
pflag.BoolVar(&fNoCache, "nocache", false, "disable the cache.")
pflag.BoolVar(&fNoCache, "cache", false, "use the cache.")
pflag.BoolVarP(&fHelp, "help", "h", false, "show help.")
pflag.StringSliceVarP(&fField, "field", "f", nil, "specific field to lookup.")
pflag.BoolVarP(&fPretty, "pretty", "p", true, "output pretty format.")
Expand All @@ -77,6 +77,8 @@ func cmdMyIP() error {
pflag.BoolVar(&fNoColor, "nocolor", false, "disable color output.")
pflag.Parse()

fNoCache = !fNoCache

if fNoColor {
color.NoColor = true
}
Expand Down