fs.tree

Render a text tree view, with optional color in terminals.

Render a FS object as text tree views.

fs.tree.render(fs, path='/', file=None, encoding=None, max_levels=5, with_color=None, dirs_first=True, exclude=None, filter=None)

Render a directory structure in to a pretty tree.

参数:
  • fs (A FS instance) – A filesystem.
  • file (file or None) – An open file-like object to render the tree, or None for stdout.
  • max_levels (int) – Maximum number of levels to display, or None for no maximum.
  • with_color (bool) – Enable terminal color output, or None to auto-detect terminal.
  • dirs_first (bool) – Show directories first.
  • exclude (list) – Option list of directory patterns to exclude from the tree render.
  • filter – Optional list of files patterns to match in the tree render.
返回类型:

tuple

返回:

A tuple of (<directory count>, <file count>).