1
0
Fork 0
mirror of https://github.com/on4kjm/FLEcli.git synced 2025-01-19 05:01:18 +01:00

some command line tweaking

This commit is contained in:
Jean-Marc MEESSEN 2020-06-28 14:52:24 +02:00
parent bcdae46979
commit 9c903913ac
2 changed files with 21 additions and 5 deletions

View file

@ -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()
}

View file

@ -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.