File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ #
2+ # Copyright (C) 2025 HDLtools Project
3+ #
4+ # SPDX-License-Identifier: GPL-3.0-or-later
5+ #
6+
7+ """This file implements the command-line parser."""
8+
9+ import argparse
10+
11+
12+ class CLIParser :
13+ """Command-line parser."""
14+
15+ def __init__ (self , app ):
16+ self .parser = argparse .ArgumentParser ()
17+ self ._add_arguments (app )
18+
19+ def _add_arguments (self , app ):
20+ """Define the arguments based on the application type."""
21+ if app == 'comp' :
22+ self .parser .add_argument ('--top1' )
23+ self .parser .add_argument ('--top2' )
24+ self .parser .add_argument ('files' , nargs = 2 )
25+ else :
26+ self .parser .add_argument ('--top' )
27+ self .parser .add_argument ('--suffix' , default = f'_{ app } ' )
28+ self .parser .add_argument ('--output' )
29+ self .parser .add_argument ('file' )
30+
31+ def parse (self ):
32+ """Parse the command-line arguments and return them."""
33+ return self .parser .parse_args ()
You can’t perform that action at this time.
0 commit comments