io_indent
Version, currently main branch1 version
- main branchlatestOct 22, 2024
github.com/plambert/io_indent.cr
Crystal library to wrap an IO with nested indentation
0 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
io_indent:
github: plambert/io_indent.cr
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.14.0- License
- MIT
- Author
- Paul M. Lambert
Dependencies
This version declares no dependencies.
README
IO::Indent
Wrap an IO with automatic indentation. When a character is written at the start of a line, indentation
will be added. But only when a character is written, not after every EOL character.
Installation
Add it to your shard.yml:
dependencies:
io_indent:
github: plambert/io_indent.cr
Usage
Wrap an IO with a new IO::Indent, then write to it as normal. Any attempt to read will raise an exception.
io = IO::Indent.new(STDOUT)
io.puts "this is not indented"
io.indent do
io.puts "this is indented by two spaces"
io.indent
io.puts "one more level of indentation"
io.outdent
end
io.puts "back to the left"
This will produce:
this is not indented
this is indented by two spaces
one more level of indentation
back to the left
Contributing
- Fork it (https://github.com/plambert/io_indent.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Paul M. Lambert - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Oct 22, 2024
- Crystal
>= 1.14.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/plambert/io_indent.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1