1 parent 508f255 commit ae87a80Copy full SHA for ae87a80
1 file changed
codext/__init__.py
@@ -43,6 +43,8 @@ def main():
43
help="ignore|replace|strict")
44
parser.add_argument("-i", "--input-file", dest="infile")
45
parser.add_argument("-o", "--output-file", dest="outfile")
46
+ parser.add_argument("-s", "--strip-newlines", action="store_true",
47
+ dest="strip")
48
args = parser.parse_args()
49
# handle input file or stdin
50
if args.infile:
@@ -53,6 +55,8 @@ def main():
53
55
for line in __stdin_pipe():
54
56
c += line
57
# encode or decode
58
+ if args.strip:
59
+ c = re.sub("\r?\n", "", c)
60
c = getattr(codecs, ["encode", "decode"][args.decode])\
61
(c, args.encoding, args.errors)
62
# hanbdle output file or stdout
0 commit comments