File: list.py

package info (click to toggle)
python-cliff 4.11.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 672 kB
  • sloc: python: 5,207; makefile: 32; sh: 21
file content (19 lines) | stat: -rw-r--r-- 396 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import logging
import os

from cliff.lister import Lister


class Files(Lister):
    """Show a list of files in the current directory.

    The file name and size are printed by default.
    """

    log = logging.getLogger(__name__)

    def take_action(self, parsed_args):
        return (
            ('Name', 'Size'),
            ((n, os.stat(n).st_size) for n in os.listdir('.')),
        )