PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
 
Loading...
Searching...
No Matches
Public Member Functions
picurv_cli.cli._LazyVersionAction Class Reference

--version, resolving the build identity only when the flag is given. More...

Inheritance diagram for picurv_cli.cli._LazyVersionAction:
[legend]
Collaboration diagram for picurv_cli.cli._LazyVersionAction:
[legend]

Public Member Functions

 __init__ (self, option_strings, dest=argparse.SUPPRESS, default=argparse.SUPPRESS, help=None)
 Register a flag that takes no value.
 
 __call__ (self, parser, namespace, values, option_string=None)
 Print picurv <version> and exit.
 

Detailed Description

--version, resolving the build identity only when the flag is given.

argparse's own version action formats its string while the parser is built, which would run git for every command; this one defers it to the flag.

Definition at line 207 of file cli.py.

Constructor & Destructor Documentation

◆ __init__()

picurv_cli.cli._LazyVersionAction.__init__ (   self,
  option_strings,
  dest = argparse.SUPPRESS,
  default = argparse.SUPPRESS,
  help = None 
)

Register a flag that takes no value.

Parameters
[in]option_stringsFlag spellings.
[in]destUnused destination.
[in]defaultUnused default.
[in]helpHelp text.

Definition at line 214 of file cli.py.

214 def __init__(self, option_strings, dest=argparse.SUPPRESS, default=argparse.SUPPRESS, help=None):
215 """!
216 @brief Register a flag that takes no value.
217 @param[in] option_strings Flag spellings.
218 @param[in] dest Unused destination.
219 @param[in] default Unused default.
220 @param[in] help Help text.
221 """
222 super().__init__(option_strings=option_strings, dest=dest, default=default, nargs=0,
223 help=help or "show program's version number and exit")
224
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ __call__()

picurv_cli.cli._LazyVersionAction.__call__ (   self,
  parser,
  namespace,
  values,
  option_string = None 
)

Print picurv <version> and exit.

Parameters
[in]parserParser being run.
[in]namespaceUnused namespace.
[in]valuesUnused values.
[in]option_stringFlag used.

Definition at line 225 of file cli.py.

225 def __call__(self, parser, namespace, values, option_string=None):
226 """!
227 @brief Print `picurv <version>` and exit.
228 @param[in] parser Parser being run.
229 @param[in] namespace Unused namespace.
230 @param[in] values Unused values.
231 @param[in] option_string Flag used.
232 """
233 # stdout, as argparse's own version action prints it.
234 print(f"picurv {picurv_build()['version']}")
235 parser.exit()
236
237

The documentation for this class was generated from the following file: