shelmet

A shell power-up for working with the file system and running subprocess commands.


Keywords
shelmet, shell, subprocess, process, file, system, path, os, utility
License
MIT
Install
pip install shelmet==0.5.0

Documentation

shelmet

version coveralls license

A shell power-up for working with the file system and running subprocess commands.

Features

  • Run and define subprocess commands
    • run
    • cmd
  • Interact with files
    • atomicdfile, atomicdir
    • read, readchunks, readlines, readtext, readbytes
    • write, writechunks, writelines, writetext, writebytes
    • fsync, dirsync
  • Execute core shell operations
    • cp, mv, mkdir, touch
    • rm, rmfile, rmdir
    • ls, lsfiles, lsdirs
    • walk, walkfiles, walkdirs
  • Archive and backup files
    • archive, unarchive, lsarchive
    • backup
  • Other utilities
    • cd
    • environ
    • cwd, homedir
    • and more!
  • 100% test coverage
  • Fully type-annotated
  • Python 3.6+

Quickstart

Install using pip:

pip3 install shelmet

Import the sh module:

Run system commands:

Create reusable run commands that support chained commands like "pipe" | , "and" &&, "or" ||, and "after" ;:

Perform file system operations:

Perform file IO:

Backup files:

Archive files:

Get list of archive contents:

Unarchive tar and zip based archives:

Write to a new file atomically where content is written to a temporary file and then moved once finished:

Create a new directory atomically where its contents are written to a temporary directory and then moved once finished:

Temporarily change environment variables:

For more details, please see the full documentation at https://shelmet.readthedocs.io.