Show More
@@ -341,32 +341,3 b' else:' | |||||
341 | return False |
|
341 | return False | |
342 | else: |
|
342 | else: | |
343 | return True |
|
343 | return True | |
344 |
|
||||
345 |
|
||||
346 | def snip_print(str,width = 75,print_full = 0,header = ''): |
|
|||
347 | """Print a string snipping the midsection to fit in width. |
|
|||
348 |
|
||||
349 | print_full: mode control: |
|
|||
350 |
|
||||
351 | - 0: only snip long strings |
|
|||
352 | - 1: send to page() directly. |
|
|||
353 | - 2: snip long strings and ask for full length viewing with page() |
|
|||
354 |
|
||||
355 | Return 1 if snipping was necessary, 0 otherwise.""" |
|
|||
356 |
|
||||
357 | if print_full == 1: |
|
|||
358 | page(header+str) |
|
|||
359 | return 0 |
|
|||
360 |
|
||||
361 | print(header, end=' ') |
|
|||
362 | if len(str) < width: |
|
|||
363 | print(str) |
|
|||
364 | snip = 0 |
|
|||
365 | else: |
|
|||
366 | whalf = int((width -5)/2) |
|
|||
367 | print(str[:whalf] + ' <...> ' + str[-whalf:]) |
|
|||
368 | snip = 1 |
|
|||
369 | if snip and print_full == 2: |
|
|||
370 | if py3compat.input(header+' Snipped. View (y/n)? [N]').lower() == 'y': |
|
|||
371 | page(str) |
|
|||
372 | return snip |
|
General Comments 0
You need to be logged in to leave comments.
Login now