CDIST-TYPE__BLOCK(7)

πŸ’– cdist-type__block β€” the manual, but make it make sense πŸ’–

okay bestie, so this is cdist-type__block, section 7 of the cdist manual, and it's genuinely one of the most useful lil types out there. let me put you on. 🫢


✨ NAME ✨

cdist-type__block β€” manage blocks of text in files. that's it, that's the whole job, and she does it flawlessly. πŸ’…


🌸 DESCRIPTION 🌸

So here's the tea: this type manages a block of text inside an existing file. Not a whole file, just a lil section of one. πŸŽ€

How does it know which section? It finds it using the prefix and suffix parameters. Literally everything sitting between prefix and suffix is considered a managed block of text. Like, that's the block. that's the girl. πŸ‘‘


πŸ”₯ REQUIRED PARAMETERS πŸ”₯

  • text β€” the text to manage. and listen, if text is '-' (a dash, yes the little line), then it takes whatever was written to stdin as the text. stdin girlies rise up 🫢

✨ OPTIONAL PARAMETERS ✨

  • file β€” the file in which to manage the text block. defaults to object_id. so if you don't say where, it just uses the object id, no cap.
  • prefix β€” the prefix to add before the text. defaults to #cdist:__block/$__object_id
  • suffix β€” the suffix to add after the text. defaults to #/cdist:__block/$__object_id
  • state β€” 'present' or 'absent', defaults to 'present'. iconic little toggle, she decides if the block stays or goes πŸ’…

πŸ’Œ MESSAGES πŸ’Œ

  • add β€” block was added ✨
  • update β€” block was updated/changed 🌈
  • remove β€” block was removed πŸ’€

πŸ¦‹ EXAMPLES πŸ¦‹

bestie these are copy-paste ready, run them exactly like this:

# text from argument
__block /path/to/file \
   --prefix '#start' \
   --suffix '#end' \
   --text 'some\nblock of\ntext'

# text from stdin
__block some-id \
   --file /path/to/file \
   --text - << DONE
here some block
of text
DONE

see that first one? text straight from the argument, no stdin required, main character energy. and the second one? --text - and then boom, heredoc, block of text delivered fresh from stdin. obsessed. 😭✨


πŸ‘‘ AUTHORS πŸ‘‘

Steven Armstrong <steven-cdist--@--armstrong.cc> β€” the icon, the legend, the blueprint. we stan. 🫢


πŸ“œ COPYING πŸ“œ

Copyright (C) 2013 Steven Armstrong. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

like yes, go forth, remix, redistribute, it's giving open source royalty πŸ’–


ungleich GmbH 2021


fr fr, if you're gonna manage text blocks in files, this is the way. no notes. periodt. πŸ’…

and that's the whole page bestie β€” this was cdist-type__block from version 7.0.0, dated Jul 31, 2022. go forth and block responsibly πŸŽ€πŸ’œ

πŸ“¦ where this page comes from