File: console.py

package info (click to toggle)
trash-cli 0.24.5.26-0.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,972 kB
  • sloc: python: 9,789; sh: 121; makefile: 11
file content (23 lines) | stat: -rw-r--r-- 655 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from typing import TextIO

from trashcli.empty.errors import format_error_msg


class Console:
    def __init__(self, program_name, out,
                 err):  # type: (str, TextIO, TextIO) -> None
        self.program_name = program_name
        self.out = out
        self.err = err

    def print_cannot_remove_error(self, path):
        self.print_error("cannot remove %s" % path)

    def print_error(self, msg):
        self.err.write(format_error_msg(self.program_name, msg))

    def print_dry_run(self, path):
        self.out.write("would remove %s\n" % path)

    def print_removing(self, path):
        self.out.write("removing %s\n" % path)