Configuration

Store the path and the options next to your project, so --update, --check and the commit hook need no arguments.

#Config files

Use the [tool.fsg] table of your pyproject.toml or a separate .fsg.toml:

[tool.fsg]
path = "src"
depth = 2
exclude = ["*.log", "docs/api"]
summary = true
style = "rounded"

[tool.fsg.glyphs]
last = "╰── "
path = "src"
depth = 2
exclude = ["*.log", "docs/api"]
summary = true
style = "rounded"

[glyphs]
last = "╰── "

#Where fsg looks

  1. Start at the target file

    The search begins in the directory of the file given to --update or --check.

  2. Walk up

    The first directory with a .fsg.toml or a pyproject.toml holding [tool.fsg] wins. In the same directory, .fsg.toml comes first.

  3. Stop at the project boundary

    The search ends at the root of the git repository, outside a repository at your home directory.

Plain fsg ignores the configWithout --update or --check, only the command line counts, so fsg always prints the whole current directory.

#Keys

Key Type Default Description
path string "." Directory to render, relative to the config file
depth integer – Number of levels below the root, at least 1
dirs-only boolean false Render directories only
exclude list of strings [] Globs of entries to leave out
include list of strings [] Globs of entries to show, exclude wins
fence boolean true Wrap the tree in a code fence
summary boolean false Add the line with the number of directories and files
style string "unicode" unicode, ascii, rounded, heavy or double
ascii boolean false ASCII tree and status symbols
glyphs table – branch, last, pipe, space, see Styles
path stays insideA path that leaves the directory of the config file is rejected.

#Precedence

Each value comes from the most specific place that sets it. Include and exclude patterns are combined from all three.

  • Config fileDefaults for the whole project
  • Start markerOverrides the config for one tree
  • Command lineOverrides both, for every tree
# config: depth = 2, marker: depth=3
$ fsg --update README.md            # renders 3 levels
$ fsg --update README.md --depth 1  # renders 1 level
Last updated: Edit this page