Skip to content

List

The List module in Outlify helps structure list information, improving readability and visual organization when displaying grouped data in terminal applications. It is especially useful for presenting collections, options, or summaries in a clean and consistent format.

To view the demo for the List module use:

python -m outlify.list
Outlify helps you create list output in a beautiful format

The first one is the simplest: a titled list
Packages (4): ruff@1.0.0  pytest@1.2.3  mkdocs@3.2.1  mike@0.0.1

Continued...

TitledList

If you need a simple titled list in structured output, you can use TitledList.

from outlify.list import TitledList

packages = ['first', 'second', 'third']
print(TitledList(packages))
Content (3): first  second  third

title

Customize the title prefix of the list. The count will be automatically appended.

from outlify.list import TitledList

packages = ['first-package-1.0.0', 'second-package-1.2.3']
print(TitledList(packages, title='Packages'))
Packages (2): first-package-1.0.0  second-package-1.2.3

separator

Change how items are separated in the output. Default is two spaces.

from outlify.list import TitledList

fruits = ['apple', 'banana', 'orange']
print(TitledList(fruits, separator=', '))
Content (3): apple, banana, orange

title_style

You can also style title with the list, for example, paint them red, make bold or underlining the text.

You can pass a style like this:

from outlify.list import TitledList
from outlify.style import Colors, Styles

elements = ['elem1', 'elem2']
print(TitledList(elements, title_style=[Colors.red, Styles.bold]))

For details on styling, see Styles.