Skip to content

msftcangoblowm/drain-swamp-snippet

Repository files navigation

drain-swamp-snippet

Change portions of static config files

* Python 3.9 through 3.13, PyPy

New in 1.0.x

integration with drain-swamp-action; all badges; docs to py310;

New in 0.0.x

move snip from package drain-swamp;

Whats a snippet?

Within a configuration, there are times when some bit of text needs to be changed.

The only requirement is the file format should recognize pound symbol # as a comment.

A snippet without an snippet code (id)

before snippet
# @@@ editable
code block
# @@@ end
after snippet

A snippet with an snippet code (id)

before snippet
# @@@ i_am_a_snippet_co
code block
# @@@ end
after snippet

[read more]

What batteries are included?

None

This is a base package. Other authors are encouraged to:

  • not reinvent the wheel
  • avoid packages with snippet implementations, when only just want the base class, Snip

Acknowledgement

The technique and initial implementation is from Ned Batchelder

Ned Batchelder is also the author of cog which creates content by embedding both Python code and output in the original file.

Check out introduction to cog

Note

[original code] supports replacing one snippet per file, not idiot proof, nor unittested.

[coverage LICENSE:Apache-2.0]