Exemple #1
0
    def print_charts(self, options: Options = None) -> None:
        """ Prints battery information """
        if options is None:
            options = Options()

        chart = HorizontalBarChart(options)
        self.print_battery_chart(chart)
Exemple #2
0
def cli(path, every, details, exclude, header, style, text, graph,
        mark) -> None:
    """
    ** Displays Disk Usage in the terminal, graphically. **

    Customize visuals by setting colors and attributes.

    COLORS: light_red, red, dark_red, dark_blue, blue,
        cyan, yellow, green, pink, white, black, purple,
        neon, grey, beige, orange, magenta, peach.

    ATTRIBUTES: bold, dim, underlined, blink, reverse.
    """
    options: Options = Options()
    if mark:
        options.symbol = mark
    if header:
        options.header_color = header
    if text:
        options.text_color = text
    if graph:
        options.graph_color = graph
    if style:
        options.header_style = style

    exclude_list = list(exclude)

    # renderer = None
    renderer = DiskUsage(path=path,
                         exclude=exclude_list,
                         details=details,
                         every=every)
    renderer.print_charts(options)
Exemple #3
0
    def print_charts(self, options: Options = None) -> None:
        """Prints the charts based on user selection type"""
        if options is None:
            options = Options()

        if self.path:
            parts = self.grab_specific(self.path[0])
        else:
            parts = self.grab_partitions(exclude=self.exclude,
                                         every=self.every)

        chrt = HorizontalBarChart(options)
        for partname in parts:
            self.print_disk_chart(chrt, partname, parts[partname])
Exemple #4
0
def cli(arg, save, path, every,
        details, exclude, header, style,
        text, graph, mark) -> None:
    """
    ** Displays Disk Usage in the terminal, graphically. **

    Customize visuals by setting colors and attributes.

    COLORS: light_red, red, dark_red, dark_blue, blue,
        cyan, yellow, green, pink, white, black, purple,
        neon, grey, beige, orange, magenta, peach.

    ATTRIBUTES: bold, dim, underlined, blink, reverse.
    """


    options: Options = Options()
    if mark:
        options.symbol = mark
    if header:
        options.header_color = header
    if text:
        options.text_color = text
    if graph:
        options.graph_color = graph
    if style:
        options.header_style = style

    exclude_list = list(exclude)

    if arg == 'battery':
        try:
            battery = Battery()
            battery.print_charts()
        except:
            print('Battery not found!')
    elif arg == 'cpu':
        cpus = CPUFreq()
        cpus.display_separately()
    else:
        # renderer = None
        renderer = DiskUsage(
            path=path, exclude=exclude_list, details=details, every=every
        )
        if save:
            renderer.save_data(save)
        renderer.print_charts(options)
Exemple #5
0
def disk_usage(arg, save, path, every, details, exclude, header, style, text,
               graph, mark, alias) -> None:
    """
\b                                            
██╗   ██╗██╗███████╗███████╗██╗  ██╗
██║   ██║██║╚══███╔╝██╔════╝╚██╗██╔╝
██║   ██║██║  ███╔╝ █████╗   ╚███╔╝ 
╚██╗ ██╔╝██║ ███╔╝  ██╔══╝   ██╔██╗ 
 ╚████╔╝ ██║███████╗███████╗██╔╝ ██╗
  ╚═══╝  ╚═╝╚══════╝╚══════╝╚═╝  ╚═╝
    Made by: Beka Modebadze

<< Customize and display Disk Usage in the terminal >>

\b
COLORS: light_red, red, dark_red, dark_blue, blue,
    cyan, yellow, green, pink, white, black, purple,
    neon, grey, beige, orange, magenta, peach.

\b
ATTRIBUTES: bold, dim, underlined, blink, reverse.

\b
You can also give *args like [BATTERY] and [CPU]

\b
battery --> will display the battery information if found.
cpu --> will visualize the usage of each CPU in live time *(beta mode)
    """
    if alias:  # Set vizex as alias
        line = 'vizex ' + ' '.join(sys.argv[1:-1])
        append_to_bash('vizex', line)

    options: Options = Options()

    if mark:
        options.symbol = mark
    if header:
        options.header_color = header
    if text:
        options.text_color = text
    if graph:
        options.graph_color = graph
    if style:
        options.header_style = style
    exclude_list = list(exclude)

    if arg == 'battery':
        try:
            battery = Battery()
            battery.print_charts()
        except Exception:
            print('Battery not found!')
    elif arg == 'cpu':
        cpus = CPUFreq()
        cpus.display_separately()
    else:
        renderer = DiskUsage(path=path,
                             exclude=exclude_list,
                             details=details,
                             every=every)
        if save:
            renderer.save_data(save)
        renderer.print_charts(options)
Exemple #6
0
 def setUpClass(cls):
     cls.opts = Options()