aboutsummaryrefslogtreecommitdiff
path: root/test cases/common/14 configure file/basename.py
blob: d2c8662161ce0f78b9addc6361ce166aedd5b401 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3

import sys
import argparse
import os

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('text', nargs='*', type=str)
    args = parser.parse_args()

    text = args.text if isinstance(args.text, list) else [args.text]

    output = ''
    for t in text:
        t = os.path.basename(t)

        if not output:
            output += t
        else:
            output += ' ' + t

    output += '\n'

    sys.stdout.write(output)

if __name__ == '__main__':
    sys.exit(main())