mirror of
https://github.com/on4kjm/FLEcli.git
synced 2025-01-18 13:01:09 +01:00
Skip comments and blank lines
This commit is contained in:
parent
37bea93adf
commit
39c6a76dc0
2 changed files with 18 additions and 3 deletions
18
cmd/load.go
18
cmd/load.go
|
@ -21,6 +21,7 @@ import (
|
|||
"bufio"
|
||||
"log"
|
||||
"os"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// loadCmd represents the load command
|
||||
|
@ -34,8 +35,8 @@ var loadCmd = &cobra.Command{
|
|||
// This application is a tool to generate the needed files
|
||||
// to quickly create a Cobra application.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("load called")
|
||||
fmt.Println("Inputfile: ",inputFilename)
|
||||
//fmt.Println("load called")
|
||||
//fmt.Println("Inputfile: ",inputFilename)
|
||||
loadFile()
|
||||
},
|
||||
}
|
||||
|
@ -70,8 +71,21 @@ func loadFile() {
|
|||
}
|
||||
|
||||
file.Close()
|
||||
|
||||
regexpLineComment, _ := regexp.Compile("^#")
|
||||
regexpOnlySpaces, _ := regexp.Compile("^\\s+$")
|
||||
|
||||
|
||||
for _, eachline := range txtlines {
|
||||
//Skip the line if it starts with "#"
|
||||
if(regexpLineComment.MatchString(eachline)) {
|
||||
continue
|
||||
}
|
||||
//Skip if line is empty or blank
|
||||
if((len(eachline) == 0) || (regexpOnlySpaces.MatchString(eachline))) {
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Println(eachline)
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
# Header
|
||||
mycall on4kjm/p
|
||||
operator Jean-Marc
|
||||
operator on4kjm
|
||||
nickname Portable
|
||||
|
||||
# Log
|
||||
|
@ -11,6 +11,7 @@ date 2020-05-23
|
|||
7.037 1012 on6zq 9 449
|
||||
1020 dk5zx 9 7
|
||||
30m cw
|
||||
|
||||
10.120 1040 ol901ab 9 42
|
||||
20m
|
||||
14.017 1055 ly2nk 9 9
|
||||
|
|
Loading…
Reference in a new issue