Skip to content

TylerDurham/cwrap-py

Repository files navigation

#cwrap-(py)thon

# ____ _ _ _ ____ ____ ___     ___  _   _ 
# |    | | | |__/ |__| |__] __ |__]  \_/  
# |___ |_|_| |  \ |  | |       |      |   
#                                         

Version: 0.2.7

cwrap(py), written in (py)thon. Nothing more than a handy file comment header utility that helps easily me see (with my old eyes) what file I am working on.

Install

Clone the repo:

git clone https://github.com/TylerDurham/cwrap-python

I like to use uv to build and install:

uv build
uv tool install dist/cwrap*.whl  

Note: Shell completions can be added by running cwrap --install-completion

To remove, run uv tool uninstall cwrap. You can also force delete with:

rm -rf ~/.local/cwrwap
rm -rf ~/.local/share/uv/tools/cwrap-py

Usage

Commands

Help

Get help:

cwrap --help

Programming Languages

List supported languages:

cwrap list-languages

Figlets

Basic Usage

Generate a simple comment wrapped figlet header:

cwrap figlet "Hello World"

This will output:

# _  _ ____ _    _    ____    _ _ _ ____ ____ _    ___  
# |__| |___ |    |    |  |    | | | |  | |__/ |    |  \ 
# |  | |___ |___ |___ |__|    |_|_| |__| |  \ |___ |__/ 
#                                                       

Note: The default figlet font is cybermedium. The default language is python.

Specifying a Figlet Font

To generate a simple comment wrapped figlet header with a specific figlet font, use the -f or --font option:

cwrap figlet -f avatar "Hello World"

This will output:

#  _     _____ _     _     ____    _      ____  ____  _     ____ 
# / \ /|/  __// \   / \   /  _ \  / \  /|/  _ \/  __\/ \   /  _ \
# | |_|||  \  | |   | |   | / \|  | |  ||| / \||  \/|| |   | | \|
# | | |||  /_ | |_/\| |_/\| \_/|  | |/\||| \_/||    /| |_/\| |_/|
# \_/ \|\____\\____/\____/\____/  \_/  \|\____/\_/\_\\____/\____/
#                                                                

Specifying a Programming Language

You can also wrap with different programming languages:

cwrap figlet -l lua "UPDATE TABLE"

This will output:

-- _  _ ___  ___  ____ ___ ____    ___ ____ ___  _    ____ 
-- |  | |__] |  \ |__|  |  |___     |  |__| |__] |    |___ 
-- |__| |    |__/ |  |  |  |___     |  |  | |__] |___ |___ 
--                                                         

Note: You can run cwrap list-languages to get a list of supported programming languages.

Multiline Comments

If the programming language supports it, you can specify the -m or --multiline option to wrap the figlet text in a multiline comment:

cwrap figlet -f avatar -l javascript -m "Hello World"

This will output:

/*
  _     _____ _     _     ____    _      ____  ____  _     ____ 
 / \ /|/  __// \   / \   /  _ \  / \  /|/  _ \/  __\/ \   /  _ \
 | |_|||  \  | |   | |   | / \|  | |  ||| / \||  \/|| |   | | \|
 | | |||  /_ | |_/\| |_/\| \_/|  | |/\||| \_/||    /| |_/\| |_/|
 \_/ \|\____\\____/\____/\____/  \_/  \|\____/\_/\_\\____/\____/
                                                                
*/

Horizontal Rules

You can add a horizontal rule at the top and bottom of the comment by specifying the --hr-width option:

cwrap figlet "Hello, HR" -l javascript --hr-width

This will output:

/*
 ======================================
 _  _ ____ _    _    ____    _  _ ____ 
 |__| |___ |    |    |  |    |__| |__/ 
 |  | |___ |___ |___ |__|    |  | |  \ 
                                       
 ======================================
*/

Clipboard Support

You can place the generated text on the clipboard by specifying the -c option:

cwrap figlet "Hello, Clipboard" -c

Local Development

See Local Development

About

A comment header that uses figlet written in python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published