PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
 
Loading...
Searching...
No Matches
Functions
picurv_cli.main Namespace Reference

Functions

 _selected_subparser (parser, args)
 The deepest sub-command parser the parsed arguments selected.
 
 main ()
 Parse command-line arguments and dispatch the requested command.
 

Detailed Description

Command-line entrypoint for the PICurv conductor.

Function Documentation

◆ _selected_subparser()

picurv_cli.main._selected_subparser (   parser,
  args 
)
protected

The deepest sub-command parser the parsed arguments selected.

Parameters
[in]parserTop-level parser.
[in]argsNamespace from parsing with parser.
Returns
The parser whose usage describes the selected command.

Definition at line 8 of file main.py.

8def _selected_subparser(parser, args):
9 """!
10 @brief The deepest sub-command parser the parsed arguments selected.
11 @param[in] parser Top-level parser.
12 @param[in] args Namespace from parsing with @p parser.
13 @return The parser whose usage describes the selected command.
14 """
15 while True:
16 actions = [action for action in parser._actions if isinstance(action, argparse._SubParsersAction)]
17 name = getattr(args, actions[0].dest, None) if actions else None
18 if name not in (actions[0].choices if actions else {}):
19 return parser
20 parser = actions[0].choices[name]
21
22
Here is the caller graph for this function:

◆ main()

picurv_cli.main.main ( )

Parse command-line arguments and dispatch the requested command.

Commands that forward arguments to make take its options after --; an option given before it is reported by the command it was given to, with that form.

Definition at line 23 of file main.py.

23def main():
24 """!
25 @brief Parse command-line arguments and dispatch the requested command.
26 @details Commands that forward arguments to make take its options after `--`; an option
27 given before it is reported by the command it was given to, with that form.
28 """
29 parser = build_main_parser()
30 args, unknown = parser.parse_known_args()
31 if unknown:
32 message = f"unrecognized arguments: {' '.join(unknown)}"
33 if hasattr(args, "make_args"):
34 message += f"; pass make options after '--', as in 'picurv {args.command} -- {unknown[0]}'"
35 _selected_subparser(parser, args).error(message)
36 if getattr(args, "make_args", None) and args.make_args[0] == "--":
37 args.make_args = args.make_args[1:]
38 dispatch_command(args)
int main(int argc, char **argv)
Entry point for the postprocessor executable.
Here is the call graph for this function: