Skip to content

Commit a6430b0

Browse files
committed
Spruce up fold command.
1 parent 350ab50 commit a6430b0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

darkbox/commands/fold.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ def get_parser(self):
2424

2525
def run(self):
2626
args = self.get_args()
27-
27+
width = args['width']
28+
2829
for i in args['files']:
2930
try:
3031
with open(i, 'r') as f:
3132
for line in f:
32-
# dear god solve this. its awful. but functional.
33-
for part in [line.rstrip('\n')[n:n+args['width']] for n in range(0, len(line), args['width'])]:
34-
print(part)
35-
33+
for n in range(0, len(line), width):
34+
print(line.rstrip('\n')[n:n+width])
3635
except FileNotFoundError:
3736
self.file_not_found_error(i)
3837

0 commit comments

Comments
 (0)