LinuxCommandLibrary

cli-wrapper

Wrap command-line interfaces for easier use

SYNOPSIS

cli-wrapper [OPTIONS] <command> [ARGS...]

PARAMETERS

-h, --help
    Display help and exit

--version
    Print version info

-l, --log FILE
    Log stdout/stderr to FILE

-t, --timeout SECONDS
    Kill command after timeout

-e, --env KEY=VALUE
    Set environment variable

-i, --input FILE
    Feed input from FILE

-o, --output FILE
    Capture output to FILE

-v, --verbose
    Enable verbose logging

-q, --quiet
    Suppress output

DESCRIPTION

cli-wrapper is not a standard Linux command included in major distributions' core packages like coreutils or util-linux. It is typically a custom or third-party script/utility found in development toolchains, testing frameworks (e.g., Pytest CLI wrappers), or specific projects on GitHub.

Its primary purpose is to wrap an existing command-line interface (CLI) application, adding layers such as logging, timing, environment injection, output capture, or error handling without altering the original command. This is useful for unit testing CLI tools, CI/CD pipelines, debugging, or standardizing invocation in scripts.

Implementations vary: some are Bash/Python scripts that exec the target command after preprocessing args; others integrate with tools like "pexpect" for interactive sessions. Usage often involves piping output or mocking stdin. Always verify the specific version's source, as no unified man page exists. Common in Node.js/Python ecosystems for app scaffolding.

CAVEATS

Non-standard; behavior depends on implementation. May not handle all shell features. Test thoroughly in scripts.

EXAMPLE USAGE

cli-wrapper -l output.log -t 30 ls -la
cli-wrapper --env DEBUG=1 myapp --config config.yaml

INSTALLATION

Typically via pip/npm: pip install cli-wrapper or git clone from repo. Not in apt/yum repos.

HISTORY

Emerged in mid-2010s in open-source dev tools (e.g., Python CLI testing libs). Popularized via GitHub repos for simplifying mocks in pytest, jest-cli. No formal upstream; evolves per project needs.

SEE ALSO

env(1), timeout(1), script(1), nice(1), strace(1)

Copied to clipboard