From b81a82874949fb6c6e873f7c066ef9e8bce29a34 Mon Sep 17 00:00:00 2001 From: Bryan Nehl Date: Tue, 19 Mar 2024 16:04:22 -0400 Subject: [PATCH 1/3] Revert "Permit comment after other input on the line (#119)" (#125) This reverts commit caefd4699441244e8e469df04a402e3df8cc4497. --- fleprocess/load_file.go | 5 ----- fleprocess/load_file_test.go | 9 --------- 2 files changed, 14 deletions(-) diff --git a/fleprocess/load_file.go b/fleprocess/load_file.go index a1094c3..2fd9bac 100644 --- a/fleprocess/load_file.go +++ b/fleprocess/load_file.go @@ -53,7 +53,6 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL isInferTimeFatalError := false regexpLineComment := regexp.MustCompile(`^[[:blank:]]*#`) - regexpInLineComment := regexp.MustCompile(`.*#.*`) regexpOnlySpaces := regexp.MustCompile(`^\s+$`) regexpSingleMultiLineComment := regexp.MustCompile(`^[[:blank:]]*{.+}$`) regexpStartMultiLineComment := regexp.MustCompile(`^[[:blank:]]*{`) @@ -105,10 +104,6 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL if (len(eachline) == 0) || (regexpOnlySpaces.MatchString(eachline)) { continue } - // a comment starts somewhere on the line, remove the comment - if regexpInLineComment.MatchString(eachline) { - eachline = strings.Split(eachline, "#")[0] - } // Process multi-line comments if regexpStartMultiLineComment.MatchString(eachline) { diff --git a/fleprocess/load_file_test.go b/fleprocess/load_file_test.go index d6501ca..29e984e 100644 --- a/fleprocess/load_file_test.go +++ b/fleprocess/load_file_test.go @@ -49,7 +49,6 @@ func TestLoadFile_happyCase(t *testing.T) { dataArray = append(dataArray, "40m cw 0950 ik5zve/5 9 5") dataArray = append(dataArray, "on6zq") dataArray = append(dataArray, "0954 on4do") - dataArray = append(dataArray, "0955 k0emt # on line comment") temporaryDataFileName := createTestFile(dataArray) @@ -116,14 +115,6 @@ func TestLoadFile_happyCase(t *testing.T) { if loadedLogFile[2].Time != expectedValue { t.Errorf("Not the expected Time[2] value: %s (expecting %s)", loadedLogFile[2].Time, expectedValue) } - expectedValue = "K0EMT" - if loadedLogFile[3].Call != expectedValue { - t.Errorf("Not the expected Call[3] value: %s (expecting %s)", loadedLogFile[3].Call, expectedValue) - } - expectedValue = "0955" - if loadedLogFile[3].Time != expectedValue { - t.Errorf("Not the expected Time[3] value: %s (expecting %s)", loadedLogFile[3].Time, expectedValue) - } //Clean Up os.Remove(temporaryDataFileName) } From 170eb1b0daf3f5f3d21853dfacb97a90f310c1c0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 21:15:50 +0100 Subject: [PATCH 2/3] Bump codecov/codecov-action from 4.0.1 to 4.1.0 (#127) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.0.1 to 4.1.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4.0.1...v4.1.0) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22a3e4c..6cf479f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: make test-coverage - name: Upload Coverage report to CodeCov - uses: codecov/codecov-action@v4.0.1 + uses: codecov/codecov-action@v4.1.0 with: token: ${{secrets.CODECOV_TOKEN}} file: ./coverage.txt From 5b406438688ea6ee427bddd3cb3716e2cb8caa95 Mon Sep 17 00:00:00 2001 From: Nic Heath Date: Tue, 19 Mar 2024 15:23:24 -0500 Subject: [PATCH 3/3] Add support for MY_CNTY adif tag. (#128) * Add support for exporting MY_CNTY using mycounty in the header e.g. 'mycounty Ham County'. * Add MyCounty to displayLog in the nice console summary. --------- Co-authored-by: Jean-Marc MEESSEN --- fleprocess/adif_write.go | 3 +++ fleprocess/adif_write_test.go | 4 ++-- fleprocess/displayLog.go | 4 ++++ fleprocess/load_file.go | 13 +++++++++++++ fleprocess/load_file_test.go | 5 +++++ fleprocess/parse_line.go | 1 + 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/fleprocess/adif_write.go b/fleprocess/adif_write.go index c81a18b..a7e3d20 100644 --- a/fleprocess/adif_write.go +++ b/fleprocess/adif_write.go @@ -93,6 +93,9 @@ func buildAdif(fullLog []LogLine, adifParams AdifParams) (adifList []string) { if logLine.MyGrid != "" { adifLine.WriteString(adifElement("MY_GRIDSQUARE", logLine.MyGrid)) } + if logLine.MyCounty != "" { + adifLine.WriteString(adifElement("MY_CNTY", logLine.MyCounty)) + } if logLine.Nickname != "" { adifLine.WriteString(adifElement("APP_EQSL_QTH_NICKNAME", logLine.Nickname)) } diff --git a/fleprocess/adif_write_test.go b/fleprocess/adif_write_test.go index bd27398..74b84c8 100644 --- a/fleprocess/adif_write_test.go +++ b/fleprocess/adif_write_test.go @@ -96,7 +96,7 @@ func Test_buildAdif(t *testing.T) { sampleFilledLogPOTA := []LogLine{ {MyCall: "ON4KJM/P", Call: "S57LC", Date: "2020-05-24", Time: "1310", Band: "20m", Frequency: "14.045", Mode: "CW", RSTsent: "599", RSTrcvd: "599", MyPOTA: "ON-00259", Operator: "ON4KJM", Nickname: "ON-00259-1"}, - {MyCall: "ON4KJM/P", Call: "ON4LY", Date: "2020-05-24", Time: "1312", Band: "20m", Mode: "CW", RSTsent: "559", RSTrcvd: "599", MyPOTA: "ON-00259", Operator: "ON4KJM"}, + {MyCall: "ON4KJM/P", Call: "ON4LY", Date: "2020-05-24", Time: "1312", Band: "20m", Mode: "CW", RSTsent: "559", RSTrcvd: "599", MyPOTA: "ON-00259", Operator: "ON4KJM", MyCounty: "Ham County"}, } expectedOutputPOTA := []string{ @@ -105,7 +105,7 @@ func Test_buildAdif(t *testing.T) { "3.1.0", "", "ON4KJM/P S57LC 20200524 1310 20m CW 14.045 599 599 POTA ON-00259 ON4KJM ON-00259-1 ", - "ON4KJM/P ON4LY 20200524 1312 20m CW 559 599 POTA ON-00259 ON4KJM ", + "ON4KJM/P ON4LY 20200524 1312 20m CW 559 599 POTA ON-00259 ON4KJM Ham County ", } sampleFilledLogPOTA2 := []LogLine{ diff --git a/fleprocess/displayLog.go b/fleprocess/displayLog.go index c6886a4..a96252c 100644 --- a/fleprocess/displayLog.go +++ b/fleprocess/displayLog.go @@ -79,6 +79,10 @@ func SprintHeaderValues(logLine LogLine) string { output.WriteString("MyGrid " + logLine.MyGrid + "\n") } + if logLine.MyCounty != "" { + output.WriteString("MyCounty " + logLine.MyCounty + "\n") + } + return output.String() } diff --git a/fleprocess/load_file.go b/fleprocess/load_file.go index 2fd9bac..024af7e 100644 --- a/fleprocess/load_file.go +++ b/fleprocess/load_file.go @@ -64,6 +64,7 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL regexpHeaderMySota := regexp.MustCompile(`(?i)^mysota\s+`) regexpHeaderMyPota := regexp.MustCompile(`(?i)^mypota\s+`) regexpHeaderMyGrid := regexp.MustCompile(`(?i)^mygrid\s+`) + regexpHeaderMyCounty := regexp.MustCompile(`(?i)^mycounty\s+`) regexpHeaderQslMsg := regexp.MustCompile(`(?i)^qslmsg\s+`) regexpHeaderNickname := regexp.MustCompile(`(?i)^nickname\s+`) @@ -73,6 +74,7 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL headerMySOTA := "" headerMyPOTA := "" headerMyGrid := "" + headerMyCounty := "" headerQslMsg := "" headerNickname := "" //headerDate := "" @@ -245,6 +247,16 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL continue } + //My County + if regexpHeaderMyCounty.MatchString(eachline) { + myMyCountyList := regexpHeaderMyCounty.Split(eachline, -1) + if len(myMyCountyList[1]) > 0 { + headerMyCounty = myMyCountyList[1] + } + //If there is no data after the marker, we just skip the data. + continue + } + //QSL Message if regexpHeaderQslMsg.MatchString(eachline) { myQslMsgList := regexpHeaderQslMsg.Split(eachline, -1) @@ -283,6 +295,7 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL previousLogLine.MyPOTA = headerMyPOTA previousLogLine.MySOTA = headerMySOTA previousLogLine.MyGrid = headerMyGrid + previousLogLine.MyCounty = headerMyCounty previousLogLine.QSLmsg = headerQslMsg //previousLogLine.QslMsg is redundant previousLogLine.Nickname = headerNickname diff --git a/fleprocess/load_file_test.go b/fleprocess/load_file_test.go index 29e984e..6f2a5bd 100644 --- a/fleprocess/load_file_test.go +++ b/fleprocess/load_file_test.go @@ -42,6 +42,7 @@ func TestLoadFile_happyCase(t *testing.T) { dataArray = append(dataArray, "mySota on/on-001") dataArray = append(dataArray, "myPota k-0802") dataArray = append(dataArray, "myGrid jo50") + dataArray = append(dataArray, "myCounty Ham County") dataArray = append(dataArray, "QslMsg This is a QSL message") dataArray = append(dataArray, " ") dataArray = append(dataArray, " #Log") @@ -87,6 +88,10 @@ func TestLoadFile_happyCase(t *testing.T) { if loadedLogFile[0].QSLmsg != expectedValue { t.Errorf("Not the expected QSL Message from Header value: %s (expecting %s)", loadedLogFile[0].QSLmsg, expectedValue) } + expectedValue = "Ham County" + if loadedLogFile[0].MyCounty != expectedValue { + t.Errorf("Not the expected MyCounty from Header value: %s (expecting %s)", loadedLogFile[0].MyCounty, expectedValue) + } expectedValue = "IK5ZVE/5" if loadedLogFile[0].Call != expectedValue { t.Errorf("Not the expected Call[0] value: %s (expecting %s)", loadedLogFile[0].Call, expectedValue) diff --git a/fleprocess/parse_line.go b/fleprocess/parse_line.go index c0e4181..07ea668 100644 --- a/fleprocess/parse_line.go +++ b/fleprocess/parse_line.go @@ -34,6 +34,7 @@ type LogLine struct { MyPota string MySota string MyGrid string + MyCounty string QslMsgFromHeader string Nickname string Mode string