Skip to content

Commit

Permalink
dev: Fix source flag
Browse files Browse the repository at this point in the history
  • Loading branch information
happyRip committed Apr 17, 2023
1 parent f72dd56 commit bc8d4e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ package cmd

import (
"context"
"fmt"
"os"
"strings"

"github.com/spf13/cobra"
"go.thethings.network/lorawan-stack-migrate/pkg/source"
Expand Down Expand Up @@ -82,8 +80,4 @@ func init() {
"frequency-plans-url",
"https://raw.githubusercontent.com/TheThingsNetwork/lorawan-frequency-plans/master",
"URL for fetching frequency plans")
rootCmd.PersistentFlags().StringVar(&rootCfg.Source,
"source",
"",
fmt.Sprintf("source (%s)", strings.Join(source.Names(), "|")))
}
5 changes: 4 additions & 1 deletion pkg/source/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ func FlagSet() *pflag.FlagSet {
names = append(names, r.Name)
}
}
flags.String("source", "", fmt.Sprintf("source (%s)", strings.Join(names, "|")))
flags.StringVar(&RootConfig.Source,
"source",
"",
fmt.Sprintf("source (%s)", strings.Join(Names(), "|")))
return flags
}

Expand Down

0 comments on commit bc8d4e5

Please sign in to comment.