Skip to main content

Python package and CLI tool for executing shell commands in a pseudo-terminal

Project description

NaughTTY

CircleCI codecov Documentation Status

NaughTTY is a CLI tool and Python package for running commands in a pseudo-terminal.

Full documentation is published at naughtty.readthedocs.io.

Installation

NaughTTY requires Python 3.8 or later and a compatible operating system.

pip install naughtty

NaughTTY requires the host operating system to support forking and pseudo-terminals. GNU/Linux is good. At the time of writing, Windows is not.

Basic CLI usage

naughtty APP > output-with-escape-codes.txt
naughtty APP | APP-THAT-USES-ESCAPE-CODES

For example:

naughtty pipenv --help > help.txt
naughtty pipenv --help | less

Full documentation is published at naughtty.readthedocs.io.

Basic Python usage

from naughtty import NaughTTY

ntty = NaughTTY(["pipenv", "--help"])
ntty.execute()
print(ntty.output)
Usage: \033[39m\033[1mpipenv\033[39m\033[22m [OPTIONS] COMMAND [ARGS]...

\033[39m\033[1mOptions:\033[39m\033[22m
  --where                         Output project home information.
  --venv                          Output virtualenv information.
  --py                            Output Python interpreter information.
  --envs                          Output Environment Variable options.
  --rm                            Remove the virtualenv.
  --bare                          Minimal output.
  --completion                    Output completion (to be executed by the
                                \033[33m\033[1m  shell\033[39m\033[22m).
...

Full documentation is published at naughtty.readthedocs.io.

👋 Hello!

Hello! I'm Cariad Eccleston and I'm an independent/freelance software engineer. If my work has value to you, please consider sponsoring.

If you ever raise a bug, request a feature or ask a question then mention that you're a sponsor and I'll respond as a priority. Thank you!

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

naughtty-1.0.1-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

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