40
|
1 #!/usr/bin/env python
|
|
2
|
42
|
3 """
|
|
4 make a string one line
|
|
5 """
|
|
6
|
|
7 import sys
|
43
|
8 from .decorator import lines
|
42
|
9
|
43
|
10 @lines
|
40
|
11 def onelineit(string):
|
42
|
12 """make a string one line"""
|
|
13
|
40
|
14 string = [ i.strip() or '\n' for i in string ]
|
|
15 string = ' '.join(string)
|
|
16 string = string.split('\n')
|
|
17 string = [ i.strip() for i in string if i.strip() ]
|
|
18
|
43
|
19 return '\n\n'.join(string).splitlines()
|
40
|
20
|
42
|
21 def main(args=sys.argv[1:]):
|
|
22 """CLI"""
|
|
23 print (onelineit(sys.stdin.read()))
|
|
24
|
40
|
25 if __name__ == '__main__':
|
42
|
26 main()
|