pycli-color

Standardize colored help output for Python argparse CLIs.

Updated Feb 3, 2026
One-click install
npx skills add https://github.com/canyangliunian/Agent-skills --skill pycli-color
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pycli-color
Source: https://github.com/canyangliunian/Agent-skills/tree/main/pycli-color
Command: npx skills add https://github.com/canyangliunian/Agent-skills --skill pycli-color

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

argparse-based CLIs often have inconsistent help output across projects. This skill standardizes the coloring of option tokens (starting with -) and metavars (UPPERCASE or containing _) in -h/--help, enabling controlled color strategies like auto, NO_COLOR, and FORCE_COLOR.

Core Features & Use Cases

  • Standardized, colorized help formatter for Python argparse CLIs.
  • Supports deterministic coloring rules for option tokens and metavar tokens, plus a tunable color enablement policy.
  • Works across scripts via a reusable ColorHelpFormatter and a minimal CLI example like the included demo.

Quick Start

Run the provided demo script to verify colored --help output in a local environment.

Frequently Asked Questions about pycli-color

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add colorized help output to a Python argparse CLI?▼

You can add colorized help output to a Python argparse CLI by implementing a custom ColorHelpFormatter subclass that standardizes coloring for option tokens and metavars in the -h/--help output.

How does argparse handle NO_COLOR and FORCE_COLOR environment variables?▼

A custom argparse ColorHelpFormatter implements color enablement logic that explicitly checks for NO_COLOR and FORCE_COLOR environment variables to control, disable, or force colored terminal output.

What is the best way to standardize visual prompts across Python terminal scripts?▼

The best way to standardize visual prompts across Python terminal scripts is using a reusable ColorHelpFormatter to apply deterministic coloring rules to option tokens and metavar tokens in argparse help output.

Can I use a color formatter with an argparse CLI that has required, optional, and choices arguments?▼

Yes, the ColorHelpFormatter works with a minimal argparse CLI setup that includes required options, optional arguments, and choices, applying consistent color schemes across all help text elements.

How do I test colored terminal output for an argparse script locally?▼

You can test colored terminal output locally by running the provided demo script, which serves as a minimal CLI example to verify the standardized color help formatter behavior in your environment.