some command line tweaking

pull/2/head
Jean-Marc MEESSEN 4 years ago
parent bcdae46979
commit 9c903913ac

@ -23,6 +23,9 @@ import (
//"strings"
)
var outputFilename string
var isWwff bool
// adifCmd is executed when choosing the adif option (load and generate adif file)
var adifCmd = &cobra.Command{
Use: "adif",
@ -31,14 +34,25 @@ var adifCmd = &cobra.Command{
// and usage of using your command. For example:
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("adif called")
fmt.Println("Inputfile: ", inputFilename)
loadFile()
processAdifCommand()
},
}
func init() {
rootCmd.AddCommand(adifCmd)
adifCmd.PersistentFlags().BoolP("wwff", "w", false, "Generates an ADIF file ready to be uploaded on WWFF")
adifCmd.PersistentFlags().BoolVarP(&isWwff,"wwff", "w", false, "Generates an ADIF file ready to be uploaded on WWFF")
adifCmd.PersistentFlags().StringVarP(&outputFilename, "output", "o", "", "Output filename")
}
func processAdifCommand(){
verifiedOutputFilename, wasOK := buildOutputFilename(outputFilename,inputFilename,false)
fmt.Println("adif called")
fmt.Println("Inputfile: ", inputFilename)
fmt.Println("OutputFile: ", outputFilename)
fmt.Println("computed output: ", verifiedOutputFilename)
fmt.Println("Output wasOK: ", wasOK)
fmt.Println("wwff: ", isWwff)
//loadFile()
}

@ -35,6 +35,7 @@ import (
var cfgFile string
var inputFilename string
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "FLEcli",
@ -65,7 +66,8 @@ func init() {
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.FLEcli.yaml)")
rootCmd.PersistentFlags().StringVarP(&inputFilename, "inputFilename", "i", "", "FLE formatted input file")
rootCmd.PersistentFlags().StringVarP(&inputFilename, "input", "i", "", "FLE formatted input file")
rootCmd.MarkFlagRequired("input")
}
// initConfig reads in config file and ENV variables if set.

Loading…
Cancel
Save