Implement truncate command.
Add documentation.
Fixes warnings.