This commit is contained in:
John Kerl 2022-01-03 23:12:51 -05:00
parent e592cb95d0
commit a5592b00ae
5 changed files with 32 additions and 32 deletions

View file

@ -27,11 +27,11 @@ jobs:
fetch-depth: 0
# Run linter against code base
# https://github.com/codespell-project/codespell
- name: Codespell
uses: codespell-project/actions-codespell@master
with:
check_filenames: true
# ignore_words_file: .codespellignore
ignore_words_list: denom,inTerm,inout,iput,nd,nin,numer,Wit,te,wee
# https://github.com/codespell-project/codespell
ignore_words_file: .codespellignore
# ignore_words_list: denom,inout,iput,nd,nin,numer,te,wee
skip: "*.csv,*.dkvp,*.txt,*.js,*.html,*.map,./tags,./test/cases"

View file

@ -46,7 +46,7 @@ Look at the file to find names of fields:
</pre>
<pre class="pre-non-highlight-in-pair">
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR
masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Witter;Biały;Alb;Beyaz
masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
</pre>
@ -65,7 +65,7 @@ Use XTAB output format to get a sharper picture of where records/fields are bein
<b>mlr --icsv --oxtab cat data/colours.csv </b>
</pre>
<pre class="pre-non-highlight-in-pair">
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Witter;Biały;Alb;Beyaz
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
</pre>
@ -83,7 +83,7 @@ ES Blanco
FI Valkoinen
FR Blanc
IT Bianco
NL Wit
NL Witter
PL Biały
RO Alb
TR Beyaz

View file

@ -26,7 +26,7 @@ Look at the file to find names of fields:
GENMD-CARDIFY-HIGHLIGHT-ONE
cat data/colours.csv
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR
masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Witter;Biały;Alb;Beyaz
masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
GENMD-EOF
@ -41,7 +41,7 @@ Use XTAB output format to get a sharper picture of where records/fields are bein
GENMD-CARDIFY-HIGHLIGHT-ONE
mlr --icsv --oxtab cat data/colours.csv
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Witter;Biały;Alb;Beyaz
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
GENMD-EOF
@ -57,7 +57,7 @@ ES Blanco
FI Valkoinen
FR Blanc
IT Bianco
NL Wit
NL Witter
PL Biały
RO Alb
TR Beyaz

View file

@ -26,8 +26,8 @@ func termcvtUsage(verbName string, o *os.File, exitCode int) {
}
func termcvtMain(args []string) int {
inTerm := "\n"
outTerm := "\n"
inputTerminator := "\n"
outputTerminator := "\n"
doInPlace := false
// 'mlr' and 'termcvt' are already argv[0] and argv[1].
@ -49,30 +49,30 @@ func termcvtMain(args []string) int {
} else if opt == "-I" {
doInPlace = true
} else if opt == "--cr2crlf" {
inTerm = "\r"
outTerm = "\r\n"
inputTerminator = "\r"
outputTerminator = "\r\n"
} else if opt == "--lf2crlf" {
inTerm = "\n"
outTerm = "\r\n"
inputTerminator = "\n"
outputTerminator = "\r\n"
} else if opt == "--crlf2cr" {
inTerm = "\r\n"
outTerm = "\r"
inputTerminator = "\r\n"
outputTerminator = "\r"
} else if opt == "--lf2cr" {
inTerm = "\n"
outTerm = "\r"
inputTerminator = "\n"
outputTerminator = "\r"
} else if opt == "--crlf2lf" {
inTerm = "\r\n"
outTerm = "\n"
inputTerminator = "\r\n"
outputTerminator = "\n"
} else if opt == "--cr2lf" {
inTerm = "\r"
outTerm = "\n"
inputTerminator = "\r"
outputTerminator = "\n"
} else {
termcvtUsage(verb, os.Stderr, 1)
}
}
if len(args) == 0 {
termcvtFile(os.Stdin, os.Stdout, inTerm, outTerm)
termcvtFile(os.Stdin, os.Stdout, inputTerminator, outputTerminator)
} else if doInPlace {
for _, filename := range args {
@ -94,7 +94,7 @@ func termcvtMain(args []string) int {
os.Exit(1)
}
termcvtFile(istream, ostream, inTerm, outTerm)
termcvtFile(istream, ostream, inputTerminator, outputTerminator)
istream.Close()
// TODO: check return status
@ -118,7 +118,7 @@ func termcvtMain(args []string) int {
os.Exit(1)
}
termcvtFile(istream, os.Stdout, inTerm, outTerm)
termcvtFile(istream, os.Stdout, inputTerminator, outputTerminator)
istream.Close()
}
@ -126,12 +126,12 @@ func termcvtMain(args []string) int {
return 0
}
func termcvtFile(istream *os.File, ostream *os.File, inTerm string, outTerm string) {
func termcvtFile(istream *os.File, ostream *os.File, inputTerminator string, outputTerminator string) {
lineReader := bufio.NewReader(istream)
inTermFinal := []byte(inTerm[len(inTerm)-1:])[0] // bufio.Reader.ReadString takes char not string delimiter :(
inputTerminatorBytes := []byte(inputTerminator[len(inputTerminator)-1:])[0] // bufio.Reader.ReadString takes char not string delimiter :(
for {
line, err := lineReader.ReadString(inTermFinal)
line, err := lineReader.ReadString(inputTerminatorBytes)
if err == io.EOF {
break
}
@ -143,7 +143,7 @@ func termcvtFile(istream *os.File, ostream *os.File, inTerm string, outTerm stri
}
// This is how to do a chomp:
line = strings.TrimRight(line, inTerm)
ostream.Write([]byte(line + outTerm))
line = strings.TrimRight(line, inputTerminator)
ostream.Write([]byte(line + outputTerminator))
}
}

View file

@ -5,7 +5,7 @@ PUNCHDOWN LIST
* document cloudthings, e.g.
o go.yml
o codespell.yml
- codespell --ignore-words .codespellignore --skip "*.csv,*.dkvp,*.txt,./tags,./test/cases"
- codespell --check-filenames --skip *.csv,*.dkvp,*.txt,*.js,*.html,*.map,./tags,./test/cases --ignore-words-list denom,inTerm,inout,iput,nd,nin,numer,Wit,te,wee
o readthedocs triggers
* doc