Skip to content

Commit

Permalink
Change: Drop all output functions from pontos.terminal
Browse files Browse the repository at this point in the history
It's better to use a Terminal instance directly then using the terminal
indirectly via the removed output functions.
  • Loading branch information
bjoernricks committed Jun 9, 2022
1 parent ca5e375 commit dffc49a
Showing 1 changed file with 1 addition and 72 deletions.
73 changes: 1 addition & 72 deletions pontos/terminal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,77 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from pathlib import Path
from typing import Optional
from .terminal import Terminal

__term = None # pylint: disable=invalid-name

__all__ = [
'error',
'fail',
'info',
'bold_info',
'ok',
'out',
'warning',
]


def ok(message: str) -> None:
__term.ok(message)


def fail(message: str) -> None:
__term.fail(message)


def error(message: str) -> None:
__term.error(message)


def warning(message: str) -> None:
__term.warning(message)


def info(message: str) -> None:
__term.info(message)


def bold_info(message: str) -> None:
__term.bold_info(message)


def out(message: str):
__term.print(message)


def overwrite(message: str, new_line: bool = False):
__term.print_overwrite(message, new_line=new_line)


def _init_terminal(term: Terminal):
__term = term


def terminal(
term: Optional[Terminal] = None, verbose: int = 1, log_file: Path = None
) -> Terminal:
"""Init a Terminal that uses the verbosity given as in args
Arguments:
verbose integer defining the verbosity (default: 1)
log_file path to a log_file, that will be used to log
output into
"""
global __term # pylint: disable=global-statement, invalid-name
if not term:
__term = Terminal(verbose=verbose, log_file=log_file)
else:
__term = term
return __term


def _set_terminal(term: Terminal) -> Terminal:
# remove later; left for backwards-compability
return terminal(term)
__all__ = ["Terminal"]

0 comments on commit dffc49a

Please sign in to comment.