A custom tail command line tool using Python and Click.
Project description
📜 Для проєкту custom-tail (README.md)
# Custom Tail CLI (`ctail`)
[](https://badge.fury.io/py/custom-tail-cli)
[](https://github.com/bohdanfariyon/custom-tail/actions)
A simple command-line utility written in Python to display the last few lines of a file, mimicking the basic functionality of the GNU `tail` command. This tool is built using the `click` library.
---
## 🚀 Features
* **Show Last Lines**: Display the last N lines of a file (10 by default).
* **Follow Mode**: Watch a file for changes and output new lines as they are added (`-f` option).
* **Custom Line Count**: Specify the exact number of lines to display.
* **Dockerized**: Comes with a `Dockerfile` for easy containerization.
---
## 📦 Installation
You can install the package directly from PyPI:
```bash
pip install custom-tail-cli
🛠️ Usage
The main command is ctail. You must provide a file path.
Basic Usage
Show the last 10 lines of logfile.log.
ctail logfile.log
Command Options
-
-n, --lines <number>: Specify the number of lines to show.# Show the last 5 lines ctail -n 5 logfile.log
-
-f, --follow: "Follow" mode. The command will wait and display new lines as they are written to the file. This is useful for monitoring log files in real-time.ctail -f /var/log/syslog
(Press
Ctrl+Cto exit follow mode.)
🐳 Docker Usage
You can also build and run this tool as a Docker container.
-
Build the image:
docker build -t ctail-app .
-
Run the container:
To see the help message:
docker run --rm ctail-app --help
To view the tail of a file from your current directory, you need to mount it as a volume:
# This command mounts the current directory to /data inside the container # and tells ctail to read the file /data/logfile.log docker run --rm -v "$(pwd)":/data ctail-app /data/logfile.log
To use follow mode on a local file:
docker run --rm -v "$(pwd)":/data ctail-app -f /data/logfile.log
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file custom_tail_cli-0.1.0.tar.gz.
File metadata
- Download URL: custom_tail_cli-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eca02bdad08535c74178ba7395b5164a8fb267205b46347fd4bbc2c134c058c4
|
|
| MD5 |
4f10d5180ac027ff21866e0b2ff7fe7a
|
|
| BLAKE2b-256 |
f93642dd46fe26871f198cbbfb91707584ae3c390cf32ab54252d0aed5cae31f
|
File details
Details for the file custom_tail_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: custom_tail_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48ff027a925411f573fb10dbe78fc061494b77eab572ceb0d208d90524e08258
|
|
| MD5 |
6084754a687b21e3228c35842558ba03
|
|
| BLAKE2b-256 |
ddcedfe5c52279eb952ff19b6f9d5edbcb0e7636b2360ee4146ee836d006adf5
|