holygeek / pospelchek

pospelchek is aspell for po files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error executing the script without arguments

MocioF opened this issue · comments

$ pospellcheck
Unknown open() mode '|' at /usr/bin/pospelchek line 706.

(perl version is 5.30.3)

This should make it runnable with newer perl:

diff --git pospelchek pospelchek
index 66085e0..af699f8 100755
--- pospelchek
+++ pospelchek
@@ -703,11 +703,11 @@ IGNORED PHRASES
 Have fun spellchecking!
 EOF
     my $PAGER;
-    if ( open $PAGER, '|', 'less' ) {
+    if ( open $PAGER, '|-', 'less' ) {
         print $PAGER $usage_text;
         close $PAGER;
     }
-    elsif ( open $PAGER, '|', 'more' ) {
+    elsif ( open $PAGER, '|-', 'more' ) {
         print $PAGER $usage_text;
         close $PAGER;
     }

Thanks

I am trying to use the script to check .po files for a gettext project. Now I am running it with -c _,»,« but it doesn't work with _ (used as an accelerator) because the script sees underscore as a word separator. Is there a way to change this from options or similar?

I'm not sure I understand the problem. The items specified by -c is used as the regex for removing the matching text before running the spellchecker. So in your example it should be equivalent to running the text via s/_/ /g, s/»/ /g and s/«/ /g (https://github.com/holygeek/pospelchek/blob/master/pospelchek#L2093 https://github.com/holygeek/pospelchek/blob/master/pospelchek#L2013-L2020)

Thanks for your answer.
The problem is that _ is not removed, because (I think) it is seen as a word separator (like " ", or "-").
-c _,»,« makes Myword equivalent to «Myword, Myword» and «Myword», but not equivalent to My_word, because the script thinks there are 2 words: 'My' and 'word'.
I think this is an issue because gettext uses _ as an accelerator so, in the same .po file you can find _Myword, M_yword, My_word, etc but in a spell check they should be seen as the same string.

I see what you mean. I've added a new option (-C <regex>) that should achieve what you want. The lowercase -c replaces the matching text with a space, that's why it didn't work the way you intended it to. The new -C flag removes the matching text, so -C _,»,« should do it.

It is perfect, thanks a lot