diff options
Diffstat (limited to 'test cases/common/14 configure file/basename.py')
-rw-r--r-- | test cases/common/14 configure file/basename.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test cases/common/14 configure file/basename.py b/test cases/common/14 configure file/basename.py new file mode 100644 index 0000000..d2c8662 --- /dev/null +++ b/test cases/common/14 configure file/basename.py @@ -0,0 +1,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()) |