linotp.cli package

Entry point for LinOTP CLI.

The main() function in this file is installed as a console entry point in setup.py(), so that the shell command linotp calls that function.

class linotp.cli.Echo(verbosity=0)

Bases: object

Echo class, which extends click.echo() to respect verbosity.

The verbosity of the respective line is expressed by an additional parameter, v or verbosity.

The verbosity is expressed by numbers where, for example:

  • 0 is used for error messages and warnings (always displayed)

  • 1 is used for informational messages (seen with -v)

  • 2 is used for more detailed information (seen with -vv)

and so on. The verbosity level corresponds to the number of -v options that must be specified on the command like for the message to be visible. If the verbosity level is set to -1, no messages will be output at all; this is useful to implement a –quiet option that suppresses all output.

Unlike click.echo(), messages go to stderr by default. Use err=False to redirect them to stdout instead.

class linotp.cli.LinOTPGroup(**kwargs)

Bases: FlaskGroup

linotp.cli.get_backup_filename(filename: str, now: Optional[datetime] = None) str

Creates a time-stamped filename suitable for use as a “backup filename”. The given filename can contain a placeholder %s where the timestamp should be put. If no placeholder is found, the time stamp is appended, separated with ..

The time used is given as now; if now is None, the current time will be used. The time stamp is formatted as configured by “BACKUP_FILE_TIME_FORMAT” config value.