[#7] Add local tool for building database file
Added frostfs-locode-db CLI utility that can generate and view UN/LOCODE database files. Go package git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/locode copied to this repository to eliminate interdependency between frostfs-node and frostfs-locode-db projects. The process of building database files reduced to starting make command. Signed-off-by: George Bartolomey <george@bh4.ru>
This commit is contained in:
parent
7e523f1a28
commit
840b20538b
30 changed files with 2317 additions and 4 deletions
45
main.go
Normal file
45
main.go
Normal file
|
@ -0,0 +1,45 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "frostfs-locode-db",
|
||||
Short: "Command Line Tool to work with FrostFS' UN/LOCODE databases",
|
||||
Long: "This tool can be used for generating or accessing FrostFS UN/LOCODE databases.",
|
||||
}
|
||||
|
||||
func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if errFmt != "" {
|
||||
err = fmt.Errorf(errFmt, err)
|
||||
}
|
||||
|
||||
const (
|
||||
_ = iota
|
||||
internal
|
||||
aclDenied
|
||||
)
|
||||
cmd.PrintErrln(err)
|
||||
if cmd.PersistentPostRun != nil {
|
||||
cmd.PersistentPostRun(cmd, nil)
|
||||
}
|
||||
os.Exit(internal)
|
||||
}
|
||||
|
||||
func main() {
|
||||
initUtilLocodeGenerateCmd()
|
||||
initUtilLocodeInfoCmd()
|
||||
rootCmd.AddCommand(locodeGenerateCmd, locodeInfoCmd)
|
||||
err := rootCmd.Execute()
|
||||
if err != nil {
|
||||
ExitOnErr(rootCmd, "", err)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue