Josef-Friedrich / readme_patcher

Generate README files from templates. Allow input from functions calls and cli output.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This package on the Python Package Index Tests

readme_patcher

Generate README files from templates. Allow input from functions calls and cli output.

cd your-project
vim README_template.rst
poetry add --group dev readme-patcher
poetry shell
readme-patcher # README.rst

Global objects

py_project

{{ py_project.repository }}

github

https://docs.github.com/en/rest/repos/repos#get-a-repository

https://api.github.com/repos/Josef-Friedrich/readme_patcher

{{ github.name }}
{{ github.full_name }}
{{ github.description }}
{{ github.owner.login }}

badge

{{ badge.pypi }}
{{ badge.github_workflow('tests' 'Tests') }}
{{ badge.readthedocs }}

Functions

cli: Combined output (stdout and stderr) of command line interfaces (scripts / binaries)

{{ cli('awk --help') }}

func: return values of Python functions

{{ func('os.getcwd') }}

read: read text files

{{ read('code/example.py') | code('python') }}

Filters

code

{{ 'print("example")' | code('python') }}
.. code-block:: python

    print("example")

literal

{{ func('os.getcwd') | literal }}
::

    /home/repos/project

heading

{{ 'heading 1' | heading(1) }}

{{ 'heading 2' | heading(2) }}

{{ 'heading 3' | heading(3) }}

{{ 'heading 4' | heading(4) }}
heading 1
=========

heading 2
---------

heading 3
^^^^^^^^^

heading 4
"""""""""

Examples

{% for command in [
                  'dns-ipv6-prefix.py',
                  'extract-pdftext.py',
                  'find-dupes-by-size.py',
                  'list-files.py',
                  'mac-to-eui64.py',
                  'pdf-compress.py',
                  'image-into-pdf.py'
                  ]
%}

``{{ command }}``

{{ cli('{} --help'.format(command)) | literal }}
{% endfor %}

Configuration

[[tool.readme_patcher.file]]
src = "README_template.rst"
dest = "README.rst"
variables = { cwd = "func:os.getcwd", fortune = "cli:fortune --help" }

About

Generate README files from templates. Allow input from functions calls and cli output.

License:MIT License


Languages

Language:Python 100.0%