Skip to content

Commands API Reference

Text Utils

Uppercase

uppercase

Convert text to uppercase.

This module provides a command to convert input text to uppercase.

uppercase(text=typer.Argument(..., help='Text to convert to uppercase'), copy=typer.Option(False, '--copy', '-c', help='Copy result to clipboard'))

Convert text to UPPERCASE.

Parameters:

Name Type Description Default
text str

The text to convert to uppercase

Argument(..., help='Text to convert to uppercase')
copy bool

If True, copy the result to clipboard (uses xclip/xsel/wl-copy on Linux)

Option(False, '--copy', '-c', help='Copy result to clipboard')
Example

$ cli-utils local text-utils uppercase "hello world" HELLO WORLD

$ cli-utils local text-utils uppercase "hello world" --copy HELLO WORLD ✓ Copied to clipboard

Source code in src/cli_utils/commands/local/text_utils/uppercase.py
def uppercase(
    text: str = typer.Argument(..., help="Text to convert to uppercase"),
    copy: bool = typer.Option(False, "--copy", "-c", help="Copy result to clipboard"),
) -> None:
    """Convert text to UPPERCASE.

    Args:
        text: The text to convert to uppercase
        copy: If True, copy the result to clipboard (uses xclip/xsel/wl-copy on Linux)

    Example:
        $ cli-utils local text-utils uppercase "hello world"
        HELLO WORLD

        $ cli-utils local text-utils uppercase "hello world" --copy
        HELLO WORLD
        ✓ Copied to clipboard
    """
    result = text.upper()

    console.print(f"[green]{result}[/green]")

    if copy:
        copy_to_clipboard(result)

Lowercase

lowercase

Convert text to lowercase.

This module provides a command to convert input text to lowercase.

lowercase(text=typer.Argument(..., help='Text to convert to lowercase'), copy=typer.Option(False, '--copy', '-c', help='Copy result to clipboard'))

Convert text to lowercase.

Parameters:

Name Type Description Default
text str

The text to convert to lowercase

Argument(..., help='Text to convert to lowercase')
copy bool

If True, copy the result to clipboard (uses xclip/xsel/wl-copy on Linux)

Option(False, '--copy', '-c', help='Copy result to clipboard')
Example

$ cli-utils local text-utils lowercase "HELLO WORLD" hello world

$ cli-utils local text-utils lowercase "HELLO WORLD" --copy hello world ✓ Copied to clipboard

Source code in src/cli_utils/commands/local/text_utils/lowercase.py
def lowercase(
    text: str = typer.Argument(..., help="Text to convert to lowercase"),
    copy: bool = typer.Option(False, "--copy", "-c", help="Copy result to clipboard"),
) -> None:
    """Convert text to lowercase.

    Args:
        text: The text to convert to lowercase
        copy: If True, copy the result to clipboard (uses xclip/xsel/wl-copy on Linux)

    Example:
        $ cli-utils local text-utils lowercase "HELLO WORLD"
        hello world

        $ cli-utils local text-utils lowercase "HELLO WORLD" --copy
        hello world
        ✓ Copied to clipboard
    """
    result = text.lower()

    console.print(f"[green]{result}[/green]")

    if copy:
        copy_to_clipboard(result)

Titlecase

titlecase

Convert text to title case.

This module provides a command to convert input text to title case.

titlecase(text=typer.Argument(..., help='Text to convert to title case'), copy=typer.Option(False, '--copy', '-c', help='Copy result to clipboard'))

Convert text to Title Case.

Parameters:

Name Type Description Default
text str

The text to convert to title case

Argument(..., help='Text to convert to title case')
copy bool

If True, copy the result to clipboard (uses xclip/xsel/wl-copy on Linux)

Option(False, '--copy', '-c', help='Copy result to clipboard')
Example

$ cli-utils local text-utils titlecase "hello world" Hello World

$ cli-utils local text-utils titlecase "hello world" --copy Hello World ✓ Copied to clipboard

Source code in src/cli_utils/commands/local/text_utils/titlecase.py
def titlecase(
    text: str = typer.Argument(..., help="Text to convert to title case"),
    copy: bool = typer.Option(False, "--copy", "-c", help="Copy result to clipboard"),
) -> None:
    """Convert text to Title Case.

    Args:
        text: The text to convert to title case
        copy: If True, copy the result to clipboard (uses xclip/xsel/wl-copy on Linux)

    Example:
        $ cli-utils local text-utils titlecase "hello world"
        Hello World

        $ cli-utils local text-utils titlecase "hello world" --copy
        Hello World
        ✓ Copied to clipboard
    """
    result = text.title()

    console.print(f"[green]{result}[/green]")

    if copy:
        copy_to_clipboard(result)