From 8eff8412b7f3eb0471b11e5fa8d3f36c32618c84 Mon Sep 17 00:00:00 2001 From: Jean-Marc MEESSEN Date: Thu, 28 May 2020 22:50:40 +0200 Subject: [PATCH] Playing with parameters --- cmd/load.go | 1 + cmd/root.go | 5 +- notes/enableGo.md | 2 + test/data/sample_contest_ru.txt | 183 ++++++++++++++++++++++++++++++ test/data/sample_contest_stew.txt | 76 +++++++++++++ test/data/sample_dxpedition.txt | 26 +++++ test/data/sample_wwff_sota.txt | 23 ++++ 7 files changed, 315 insertions(+), 1 deletion(-) create mode 100644 test/data/sample_contest_ru.txt create mode 100644 test/data/sample_contest_stew.txt create mode 100644 test/data/sample_dxpedition.txt create mode 100644 test/data/sample_wwff_sota.txt diff --git a/cmd/load.go b/cmd/load.go index df1760e..369bf26 100644 --- a/cmd/load.go +++ b/cmd/load.go @@ -33,6 +33,7 @@ var loadCmd = &cobra.Command{ // to quickly create a Cobra application.`, Run: func(cmd *cobra.Command, args []string) { fmt.Println("load called") + fmt.Println("Inputfile: ",inputFilename) }, } diff --git a/cmd/root.go b/cmd/root.go index 73b61e5..35ecddd 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -32,11 +32,13 @@ import ( ) var cfgFile string +var inputFilename string // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "FLEcli", Short: "A Command Line \"Fast Log Entry\" (FLE) processor", + TraverseChildren: true, // Long: `A longer description that spans multiple lines and likely contains // examples and usage of using your application. For example: @@ -68,7 +70,8 @@ func init() { // Cobra also supports local flags, which will only run // when this action is called directly. - rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + // rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + rootCmd.Flags().StringVarP(&inputFilename, "inputFilename", "i", "", "FLE formatted input file") } // initConfig reads in config file and ENV variables if set. diff --git a/notes/enableGo.md b/notes/enableGo.md index 2bce72b..875d76e 100644 --- a/notes/enableGo.md +++ b/notes/enableGo.md @@ -30,3 +30,5 @@ Cobra documentation available at https://github.com/spf13/cobra/blob/master/cobr * [Go by Example: Reading Files](https://gobyexample.com/reading-files) * https://stackoverflow.com/questions/8757389/reading-a-file-line-by-line-in-go +* https://www.golangprograms.com/golang-read-file-line-by-line-to-string.html + diff --git a/test/data/sample_contest_ru.txt b/test/data/sample_contest_ru.txt new file mode 100644 index 0000000..308898d --- /dev/null +++ b/test/data/sample_contest_ru.txt @@ -0,0 +1,183 @@ +{ Sample contest log ARRL RTTY Roundup + Check: Options > "Contest Logging" +- US stations send state +- Canadian stations send province +- DX stations send consecutive serial numbers in this sample starting with 33 + Check: Options > "Consecutive Serial Numbers" +- Times are interpolated in this sample + Check: Options > "Interpolate Log Times" } +{ Enter your call sign after the mycall keyword } +# Header +mycall wb9zzz + +# Log +date 2016-01-02 +rtty +15m +1839 wy7fd ,33 .wy +20m +1856 ku1t .wv + w4nf .va +1901 n4zz .tn + kn5o .la + k3ww .pa + w4lc .ky + n0ni .ia + ni8z .oh + w6wrt .ca + k9xd .il + k0ad .mn + kc4hw .al + w4gkm .tn + n2mm .nj + w3iz .ct + ai9t .il + k8ajs .oh + k4ro .tn + aa8r .mi + kj1j .nh + w3yy .va + w4dxx .ga + k5zd .ma + k2onp .ny +2010 k9dj .wi + +{ next day } +day + +20m +1144 k4gmh .va +15m +1157 k4gmh .va +20m +1210 nn1ss .nh +1211 w2yc .nj +15m +1225 nn1ss .nh +1249 k3ww .pa +20m +1252 k4qd .fl +1258 ny6dx .ny +15m +1302 w4ox .fl + n8cl .ny + wg3j .md + k9om .fl + ku1t .wv + n2mm .nj + k5ek .nc + n2wk .ny +20m kt9l .in + nd8l .oh +15m w8bi .oh + nr5m .tx + k3md .pa + aa5au .la +20m wy7fd .wy +1403 k0md .mn + ab3cv .md + n4tb .fl + k8ia .az + ke5og .tx + nn1n .ct +10m kv1j .me +20m kt0dx .co + nx0i .mo + w7rn .nv +15m kc0w .nd + ab0rx .mo + k5wp .al + ab1qb .nh + w0sd .sd +1501 k8ajs .oh + n9ck .wi + w1slf .me +20m w8jwn .mi + w1rh .ca + w1srd .ca + k0wa .ks + k0pc .mn + k3est .ca + n3rc .mt +15m n0oj .co + ab0lr .co + kd0fw .mo + w1zd .az +20m w7rn .nv +15m wb0n .mn + n1kwf .nh + wa1zam .vt + ke9i .in +1601 n0kk .mn + w7ct .ut +20m nl7v .554 +15m w4hod .al + k6ko .ca + n3rc .mt + dk40ech .188 +20m k7gs .wa + k2po .or + n7esu .id +15m ki1g .ri + nx5o .ok + k1mk .ct +20m n7bv .wa + kf7pbm .wa + ve7cc .bc + wm5h .la +15m +1701 n6ro .ca + k0bj .ks + ai6yl/7 .nv + n7bt .wa +20m + kk7pr .or + wa5zup .nm + w7ry .wa +15m + w7rn .nv + w3ll .md + k7btw .wa +20m + kl7iwc .386 + n6ro .ca +1800 n0bui .mn + wb6jjj .ca + nx5o .ok + ke9i .in +15m n0kbd .mn + w3bui .md + w1qa .ma +20m n3me .de + k0cn .mn + k4wnw .va +20m n7uvh .id + wa7lnw .ut + w4fde .sc + k4ft .ky + wa0mhj .mn +1858 kp2d .642 +1906 w1slf .me +15m +1909 ab4gg .tn +20m +1910 k1ro .nh + w1ng .ct + ac0c .ks + w0gj .ia + k8ary .sc + ab1qb .nh + w0sd .sd + aa5au .la + kd5j .ar + n6ar .fl + ku5b .tx + w9ily .il + ww4ll .ga + k3oq .md + k0pc .mn + k5ek .nc + w4pk .va + ab0lr .co + k2cye .ny + ks0aa .ks +2055 n4dsl .va diff --git a/test/data/sample_contest_stew.txt b/test/data/sample_contest_stew.txt new file mode 100644 index 0000000..c8b6cb7 --- /dev/null +++ b/test/data/sample_contest_stew.txt @@ -0,0 +1,76 @@ +{ Sample file Stew Perry Contest + Check: Logging > "Contest Logging" +- Exchanges in this contest are grid locators + Be sure to enter your own locator in the first QSO line after the comma +- Times are not interpolated in this sample +} +{ Enter your call sign after the mycall keyword } +mycall wb9zzz + +date 2015-12-18 +160m cw + +1924 ok1dol ,jn58 .jn69 + 26 e77dx .jn84 + 30 hg5a .jn97 + 32 ol7m .jo80 + 3 s57un .jn86 + 5 ok2zi .jn89 + 9 dl1dxa .jo61 + 40 dk9vz .jn39 + 4 sm5mx .jo99 + 8 f5in .jn18 + 53 s51v .jn86 + 4 f8bpn .jn05 + 9 oh2bo .kp20 +2002 pa4vhf .jo32 + 4 g3bj .io82 + 6 iv3prk .jn66 + 7 rx3apm .lo04 + 10 uw2m .kn98 + 3 yl2sm .ko37 + 4 tm6m .in78 + 5 f6ddr .jn38 + 6 uu7j .kn85 + 9 dk6xz .jn48 + 20 pi4tue .jo21 + 2 g4buo .jo01 + 3 dl5mx .jo50 + 5 ok1hfp .jn69 + 7 ha6nl .jn98 + 31 on7pq .jo10 + 3 i4ewh .jn64 +2100 tf4m .hp85 + 6 sn7q .jo91 + 13 dk2oy .jo44 + 9 dj3ra .jo72 + 5 s53o .jn86 + 20 dd5m .jn58 + 8 on9cc .jo20 + 30 ha3li .jn96 + 2 g3wph .io91 + 4 dj2ya .jo40 + +{ next day } +day + + +0632 w1bb .fn42 + 5 k8po .fn54 + 6 pa5kt .jo11 + 8 dj9mh .jo50 + 40 om6al .jn99 + 2 dl8uke .jo72 + 3 ut3ua .ko50 + 50 sm6cpy .jo67 + 2 ly9y .ko16 + 5 ok1dst .jn79 + 9 sn2i .jo93 + 9 ve3mmq .fn14 +0707 g6mc .io94 + 10 ok1fps .jo70 + 3 se0x .jo99 + 5 on4ww .jo11 + 1 dl4me .jo50 + 8 dj3we .jn57 + 25 ok1tn .jo70 + 8 n2kw/1 .fn32 \ No newline at end of file diff --git a/test/data/sample_dxpedition.txt b/test/data/sample_dxpedition.txt new file mode 100644 index 0000000..e62cd3c --- /dev/null +++ b/test/data/sample_dxpedition.txt @@ -0,0 +1,26 @@ +{ Sample FLE QSO editor file for a DXpedition } +{ Enter your call sign after the mycall keyword } +mycall wb9zzz + +{ Start your log entry with a start date using the DATE keyword in the format yyyy-mm-dd } +date 2016-06-30 + +{ Then enter band and mode } +80m cw 2335 ra3ax +dj2mx +40 dk4rm +2 oh7ms 449 559 +8 rn6bn 3 6 +51 dl5mo < strong signal > #JO50 +dl7on +3 dj2bw + +{ Times can be interpolated between two given times, e.g. between 0014 and 0038 in the following example } +day ++ 40m ssb +0014 g3fpq + ra6au + oh2pj + oh3es + sm5wp + sp8brq + 38 ua3tcj diff --git a/test/data/sample_wwff_sota.txt b/test/data/sample_wwff_sota.txt new file mode 100644 index 0000000..ce364ac --- /dev/null +++ b/test/data/sample_wwff_sota.txt @@ -0,0 +1,23 @@ +{ Sample WWFF and SOTA log } +# Header +mycall g3wgv +operator +mywwff gff-0014 +mysota g/ld-008 + +# Log +date 2016-04-24 +40m cw +1202 g4elz +4 g3noh +2m fm +1227 gw4gte +8 gw0tlk/m gwff-0021 + +date 2016-06-03 +40m cw +1404 gm0aaa 3 7 +5 on4ck/p 2 on/on-018 +7 dl0dan/p dlff-0002 dl/al-044 +20m +10 yu7ls \ No newline at end of file