MCPcopy Create free account
hub / github.com/HzaCode/OneCite / create_parser

Function create_parser

onecite/cli.py:41–115  ·  view source on GitHub ↗

Create the argument parser.

()

Source from the content-addressed store, hash-verified

39
40
41def create_parser() -> argparse.ArgumentParser:
42 """Create the argument parser."""
43 parser = argparse.ArgumentParser(
44 prog='onecite',
45 description='Citation management and academic reference toolkit',
46 formatter_class=argparse.RawDescriptionHelpFormatter,
47 epilog="""
48Examples:
49 onecite process references.txt --output-format bibtex
50 onecite process references.bib --input-type bib --template conference_paper
51 onecite process references.txt --interactive --output results.bib
52 onecite process "10.1038/nature14539"
53 onecite process "attention is all you need, Vaswani et al., NIPS 2017"
54 echo "10.1038/nature14539" | onecite process -
55 """
56 )
57
58 parser.add_argument(
59 '--version',
60 action='version',
61 version=f'%(prog)s {__version__}'
62 )
63
64 subparsers = parser.add_subparsers(dest='command', help='Available commands')
65
66 # Main processing command
67 process_parser = subparsers.add_parser(
68 'process',
69 help='Process references through the OneCite pipeline'
70 )
71 process_parser.add_argument(
72 'input_file',
73 help='Input file, "-" for stdin, or a reference string (e.g. a DOI or title)'
74 )
75 process_parser.add_argument(
76 '--input-type',
77 choices=['txt', 'bib'],
78 default='txt',
79 help='Input type (default: txt)'
80 )
81 process_parser.add_argument(
82 '--template',
83 default='journal_article_full',
84 help='Fallback BibTeX entry-type preset when auto-detection is inconclusive (default: journal_article_full)'
85 )
86 process_parser.add_argument(
87 '--output-format',
88 choices=['bibtex'],
89 default='bibtex',
90 help='Output format (default: bibtex)'
91 )
92 process_parser.add_argument(
93 '--output',
94 '-o',
95 help='Output file (default: stdout)'
96 )
97 process_parser.add_argument(
98 '--interactive',

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected