Posted to tcl by bairui at Thu Jul 19 12:51:13 GMT 2018view raw
- #--- Heredoc style proc with margin to survive editor reformatting
- # and optional indent additional to that offset from the margin.
- proc <<- {doc {margin >} {indent 0}} {
- set indent [string repeat { } $indent]
- set doc [string trim $doc]
- tailcall subst [regsub -all -lineanchor "^\\s*$margin" $doc $indent]
- }
- # example:
- proc usage {argv0 argv} {
- set usageError [<<- {
- >ERROR: [file tail ${argv0}]
- > ?--auto-update?
- > --rolback PIPTYPE PIPPACKAGE
- } > ]
- puts $usageError
- }
- usage $argv0 $argv