Skip to content

Commit 374d228

Browse files
derek73claude
andcommitted
feat: add 'python -m nameparser' debug CLI; remove monolithic tests.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent fd2018a commit 374d228

2 files changed

Lines changed: 29 additions & 2630 deletions

File tree

nameparser/__main__.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""Command-line debug helper: parse a name and print the result.
2+
3+
Usage:
4+
5+
python -m nameparser "Dr. Juan Q. Xavier de la Vega III"
6+
"""
7+
import logging
8+
import sys
9+
10+
from nameparser import HumanName
11+
12+
13+
def main() -> None:
14+
if len(sys.argv) <= 1:
15+
print('Usage: python -m nameparser "Name String"')
16+
raise SystemExit(1)
17+
log = logging.getLogger('HumanName')
18+
log.setLevel(logging.ERROR)
19+
log.addHandler(logging.StreamHandler())
20+
name_string = sys.argv[1]
21+
hn = HumanName(name_string, encoding=sys.stdout.encoding)
22+
print(repr(hn))
23+
hn.capitalize()
24+
print(repr(hn))
25+
print("Initials: " + hn.initials())
26+
27+
28+
if __name__ == '__main__':
29+
main()

0 commit comments

Comments
 (0)