Skip to main content

Simple OS Independent 'cat' Command-line Tool made in Python.

Project description

OS-Windows OS-Linux OS-MacOS


cat_win

Simple Command-line Tool made in Python
Explore the code »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Changelog
  5. License
  6. Contact

About The Project

Unittests Build-and-Check Coverage Tests

This project copies the fundamental framework of the cat command-line tool from Linux and translates its features to an OS Independent program using Python.
Over time the project evolved in subject areas of other tools like 'echo', 'grep', 'ls', 'base64'.

Additionally it includes the feature to strip and reverse the content of any given file, make use of the standard-input, which enables cat piping into each other, generating the checksum of any file, converting decimal, hexadecimal and binary numbers within any text, and much more ...

Contrary to the name of the project it is of course possible to use cat_win on Linux or MacOS!

Made With

MadeWith-Python Python

(back to top)

Getting Started

Prerequisites

  • Using cat_win as a Python-Package demands a Python-Interpreter (>= 3.7).
  • Using cat_win as an Executable (Windows only!) demands no prerequisites, hereby the stand-alone executable catw.exe is sufficient.

Installation

Version

Simply install the python package (via PyPI-cat_win):

python -m pip install --upgrade cat_win[clip]

cat_win uses the pyperclip module by default. Should any problems occur, you can also use the pyperclip3 or pyclip module. In this case simply run:

python -m pip install --upgrade cat_win

and manually install the desired module yourself.

OR alternatively you can use the compiled version (Windows only):

  1. Simply download the catw.exe file to handle filecontents.
  2. Download the cats.exe file to use the cat-shell (optional).
  3. Add the file path to your system-environment PATH-variables.

⚠️ You should never trust any executable file! Feel free to compile the package yourself (e.g. using PyInstaller).

You can verify the creation of catw.exe yourself by reading the source code, checking the origin of the file and validating the corresponding workflow used.

(back to top)

Usage

catw [FILE]... [OPTION]...
catw --help

⚠️ from v1.0.33 to v1.1.0 the entrypoint changes from cat to catw. If you wish to keep the old command, you will have to define an alias yourself.

cats [OPTION]...
cats --help
Argument / Option Description works in shell
-h, --help show help message and exit
-v, --version output version information
-d, --debug show debug information
-n, --number number all output lines
-l, --linelength display the length of each line
-e, --ends display $ at the end of each line
-t, --tabs display TAB characters as ^I
--eof, --eof display EOF characters as ^EOF
-u, --unique suppress repeated output lines
-b, --blank hide empty lines
-r, --reverse reverse output
-p, --peek only print the first and last lines
-s, --sum show sum of lines
-S, --SUM ONLY show sum of lines
-f, --files list applied files
-F, --FILES ONLY list applied files and file sizes
-g, --grep only show lines containing queried keywords
-i, --interactive use stdin
-o, --oneline take only the first stdin-line
-E, --ECHO handle every following parameter as stdin
-c, --clip copy output to clipboard
-m, --checksum show the checksums of all files
-a, --attributes show meta-information about the files
--dec, --DEC convert decimal numbers to hexadecimal and binary
--hex, --HEX convert hexadecimal numbers to decimal and binary
--bin, --BIN convert binary numbers to decimal and hexadecimal
--b64e, --b64e encode the input to base64
--b64d, --b64d decode the input from base64
--hexview, --HEXVIEW display the raw byte representation in hexadecimal
--binview, --binview display the raw byte representation in binary
--nc, --nocolor disable colored output
--nb, --nobreak do not interrupt the output on queried keywords
--nk, --nokeyword inverse the grep output
--config, --config change color configuration
-R, --R<stream> reconfigure the std-stream(s) with the parsed encoding
<stream> = 'in'/'out'/'err' (default is stdin & stdout)
enc=X set file enconding to X (default is utf-8)
find=X find/query a substring X in the given files
match=X find/query a pattern X in the given files
trunc=X:Y truncate file to lines X and Y (python-like)
[a,b] replace a with b in every line
[a:​b:c] python-like string indexing syntax (line by line)

Examples

📂 Images 📂


$ echo "Hello World :)" | catw -i [6:] | catw -i [::-1] -ln
> 1) [8] ): dlroW

$ cats --dec -nl
> >>> 12345
> 1) [53] 12345 {Hexadecimal: 0x3039; Binary: 0b11000000111001}
> >>> ...

(back to top)

Changelog

Take a look at the Changelog file.

License

This project is licensed under the MIT License - see the LICENSE file for details

Contact

SilenZcience
GitHub-SilenZcience

Project details


Release history Release notifications | RSS feed

This version

1.4.1

Download files

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

Source Distribution

cat_win-1.4.1.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cat_win-1.4.1-py3-none-any.whl (55.2 kB view details)

Uploaded Python 3

File details

Details for the file cat_win-1.4.1.tar.gz.

File metadata

  • Download URL: cat_win-1.4.1.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.10

File hashes

Hashes for cat_win-1.4.1.tar.gz
Algorithm Hash digest
SHA256 355cad3f8f7235d1e5bf7c84fb97f755c0f76c651501f5a5ab00aa1d6557d0fa
MD5 f03d6ac4f21a993a331b570185a6cd9f
BLAKE2b-256 b9d5883475498237d3c76090c036313cbe681919ad26b9194668edc28d983e18

See more details on using hashes here.

File details

Details for the file cat_win-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: cat_win-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 55.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.10

File hashes

Hashes for cat_win-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 711a5e4f1a4323e77bb0fb9effda3ab3c6b1c15c6114b2b094468fe0faffea07
MD5 912f48bebf5ef9451c3bb724013c03d2
BLAKE2b-256 91774844f4cf0648d6501598bbaf05563626222b589f62074ac75aa719443256

See more details on using hashes here.

Supported by

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