Skip to main content

LINER: fast line counter for files and folders

Project description

LINER

LINER is a fast, Git-aware command-line line counter for files and folders.

Features

  • recursive folder scanning
  • extension and glob filtering
  • hidden files toggle
  • symlink traversal with loop protection
  • Git-aware modes (--gitignore, --changed)
  • structured outputs (--csv, --json)
  • watch mode for iterative workflows
  • branded help/usage/error screens

License

This project is licensed under the MIT License. See LICENSE.

Installation

Option A: Local launcher (simple)

cp ~/Desktop/code_util_py/line.py ~/.local/bin/line
chmod +x ~/.local/bin/line

Then ensure ~/.local/bin is in PATH (see OS-specific section below).

Option B: Install as Python package

cd ~/Desktop/code_util_py
python3 -m pip install .

Option C: Install globally as CLI via pipx (recommended for users)

pipx install liner-cli

pipx installs CLI tools in isolated environments and exposes commands in PATH.

PATH Setup by OS

macOS (zsh)

  1. Add local bin and user script dir:
echo 'export PATH="$HOME/.local/bin:$HOME/Library/Python/3.9/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
  1. If using pipx:
pipx ensurepath
  1. Verify:
which line
line --help

Linux (bash/zsh)

  1. Add local bin and user script dir:
echo 'export PATH="$HOME/.local/bin:$HOME/.local/share/pipx/venvs:$PATH"' >> ~/.bashrc
source ~/.bashrc

If you use zsh, write to ~/.zshrc instead.

  1. If using pipx:
pipx ensurepath
  1. Verify:
which line
line --help

Windows (PowerShell)

  1. Typical user script directories:
  • %APPDATA%\Python\Python39\Scripts
  • %USERPROFILE%\.local\bin (if you use that layout)
  • %USERPROFILE%\.local\pipx\bin (for pipx)
  1. Add for current user:
[Environment]::SetEnvironmentVariable(
  "Path",
  $env:Path + ";$env:APPDATA\\Python\\Python39\\Scripts;$env:USERPROFILE\\.local\\pipx\\bin",
  "User"
)
  1. Restart terminal and verify:
where line
line --help

Quick Start

line --usage
line src tests --ext py,js --exclude node_modules,.git
line . --sort lines --top 20 --by-ext
line . --gitignore --changed unstaged --total-only
line . --json

Output Modes

Text

line src --ext py --sort lines --top 10

CSV (stdout)

line src --ext py --csv

JSON (file output)

line src --ext py --json

When --json is used, LINER writes a file in current working directory:

  • ./liner1.json
  • ./liner2.json
  • ...

This avoids overwriting previous reports.

Help and Usage UX

  • line --help: full parser help + LINER banner
  • line --usage: structured usage screen + LINER banner
  • invalid args (for example line -folder .): branded error + structured usage

Is publishing to community really that simple?

Short answer: technically yes, operationally there are a few important steps.

Minimal publication flow:

  1. Prepare metadata (pyproject.toml, version, license, README, classifiers).
  2. Build distributions.
  3. Validate distributions.
  4. Upload to TestPyPI.
  5. Test installation from TestPyPI.
  6. Upload to PyPI.
  7. Create release notes/tag in GitHub.

Publish to PyPI (recommended flow)

1. Build

cd ~/Desktop/code_util_py
python3 -m pip install -U build twine
python3 -m build

2. Validate artifacts

python3 -m twine check dist/*

3. Upload to TestPyPI first

python3 -m twine upload --repository testpypi dist/*

4. Install test package from TestPyPI

python3 -m pip install -i https://test.pypi.org/simple/ liner-cli
line --help

5. Upload to PyPI

python3 -m twine upload dist/*

6. Recommend install method for users

pipx install liner-cli

Important notes

  • PyPI package name must be unique.
  • Use API tokens for Twine auth (not password).
  • Keep semver-style versions and increment every release.
  • Add CI for tests/build before uploading.

Command Reference

Detailed options and examples:

Development

cd ~/Desktop/code_util_py
python3 -m venv .venv
.venv/bin/pip install -U pip pytest
.venv/bin/pip install -e .
.venv/bin/pytest -q

Compatibility

  • Python >=3.9
  • macOS and Linux tested
  • Windows supported with correct PATH setup

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

liner_cli-0.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liner_cli-0.1.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file liner_cli-0.1.0.tar.gz.

File metadata

  • Download URL: liner_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for liner_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 af03cec9d1ef8af010857cd8f42f346e2f2de10086d7acc2019f12d47e9fcd5f
MD5 623485fa6c5f8e06a2f22d48a341b62a
BLAKE2b-256 d3b5cc7d8c200d714484a9138b81128936cff8852f1a3df2165a2f16df204196

See more details on using hashes here.

File details

Details for the file liner_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: liner_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for liner_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 191aa7c092c607cec8a778b620a324f2b2386c371d325daa088c6bf830d2ba13
MD5 0b8f5e19c64441a209bc62ab3977f8e2
BLAKE2b-256 182d8d905dccb05285207b65f3c78121f1e4d072a07e49d096eaa127951b1a3e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page