aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/jaraco.text/jaraco/text/strip-prefix.py
blob: 0d7b7702dc1f9fd3e5a94489e2a6e8a1b6ef613e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import sys

from jaraco.text import Stripper


def strip_prefix():
    r"""
    Strip any common prefix from stdin.

    >>> import io, pytest
    >>> getfixture('monkeypatch').setattr('sys.stdin', io.StringIO('abcdef\nabc123'))
    >>> strip_prefix()
    def
    123
    """
    sys.stdout.writelines(Stripper.strip_prefix(sys.stdin).lines)