cli
cli copied to clipboard
Add --clear flag to docker logs command
Description
Problem
Docker logs can grow very large, making it hard to view recent entries without scrolling.
Solution
Add a --clear flag to docker logs that:
- Prompts for confirmation and truncates log files for stopped containers (permanent, requires root).
Use Cases
- Quick viewing of logs without old output cluttering the screen.
- Managing large log files on disk.
Implementation
- Log truncation uses
os.Truncatewith root check. - Includes unit tests.