forked from TrueCloudLab/frostfs-locode-db
[#21] locode: Introduce locode overriding
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
16ff77e35c
commit
f2113a9c02
4 changed files with 71 additions and 4 deletions
|
@ -16,6 +16,7 @@ type namesDB struct {
|
|||
|
||||
const (
|
||||
locodeGenerateInputFlag = "in"
|
||||
locodeGenerateOverridesFlag = "overrides"
|
||||
locodeGenerateSubDivFlag = "subdiv"
|
||||
locodeGenerateAirportsFlag = "airports"
|
||||
locodeGenerateCountriesFlag = "countries"
|
||||
|
@ -25,6 +26,7 @@ const (
|
|||
|
||||
var (
|
||||
locodeGenerateInPaths []string
|
||||
locodeGenerateOverridesPath string
|
||||
locodeGenerateSubDivPath string
|
||||
locodeGenerateAirportsPath string
|
||||
locodeGenerateCountriesPath string
|
||||
|
@ -35,11 +37,11 @@ var (
|
|||
Use: "generate",
|
||||
Short: "Generate UN/LOCODE database for FrostFS",
|
||||
Run: func(cmd *cobra.Command, _ []string) {
|
||||
|
||||
locodeDB := csvlocode.New(
|
||||
csvlocode.Prm{
|
||||
Path: locodeGenerateInPaths[0],
|
||||
SubDivPath: locodeGenerateSubDivPath,
|
||||
Path: locodeGenerateInPaths[0],
|
||||
SubDivPath: locodeGenerateSubDivPath,
|
||||
OverridesPath: locodeGenerateOverridesPath,
|
||||
},
|
||||
csvlocode.WithExtraPaths(locodeGenerateInPaths[1:]...),
|
||||
)
|
||||
|
@ -79,6 +81,8 @@ func initUtilLocodeGenerateCmd() {
|
|||
flags.StringSliceVar(&locodeGenerateInPaths, locodeGenerateInputFlag, nil, "List of paths to UN/LOCODE tables (csv)")
|
||||
_ = locodeGenerateCmd.MarkFlagRequired(locodeGenerateInputFlag)
|
||||
|
||||
flags.StringVar(&locodeGenerateOverridesPath, locodeGenerateOverridesFlag, "", "Path to UN/LOCODE override tables (csv)")
|
||||
|
||||
flags.StringVar(&locodeGenerateSubDivPath, locodeGenerateSubDivFlag, "", "Path to UN/LOCODE subdivision database (csv)")
|
||||
_ = locodeGenerateCmd.MarkFlagRequired(locodeGenerateSubDivFlag)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue