Skip to main content

Easily create runbooks from your shell commands

Project description

Shellcord

Generate runbooks and READMEs from your shell sessions.

Installation

Usage

Supported platforms

Note that this tool is in alpha and still not thoroughly tested on shells/platforms besides the following:

Python

  • 3.7
  • 3.9

Operating systems

  • Linux 5.11.0-49-generic x86_64 GNU/Linux

Shells

Confirmed working in:

  • zsh: zsh 5.8 (x86_64-ubuntu-linux-gnu)
  • bash: GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)

Limitations

Ideally, this tool would be a simple invocation of script with some logic to generate a runbook from that typescript file. However, given that script only uses a psuedo-terminal, getting the exit code is non-trivial without basically making your own shell. So we do the next best thing and use each individual shells precmd/PROMPT_COMMAND instead.

Currently, shellcord collects:

  • The command being run
  • The exit code of that command

Ideally though, it would also be able to get stdout so the generated runbook has example output.

Development

This tool is currently under development and any support is more than welcome, especially if you want to get shellcord working in your shell of choice.

Please cut issues as you see fit based on usage and feel free to send pull-requests.

Testing

Run the tests poetry run python3 -m pytest

How it works

Shellcord works by modifying the shell's precmd/PROMP_COMMAND or whatever equivalent with our own function which will:

  • Generate a unique id for each command
  • Get the exit code of the last command run
  • Get the actual command which was run last
  • Dump all that data to a scord-log file

Once all the command data has been collected, shellcord will then use the scord-log file to generate a runbook based on the parameters selected.

Components

  • init.sh: Used to setup a scord session and modify precmd
  • de-init.sh: Used to close the session and undo all the precmd work
  • shellcord.py: Used to generate runbooks and tag commands

Project details


Download files

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

Source Distribution

shellcord-0.2.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

shellcord-0.2.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file shellcord-0.2.0.tar.gz.

File metadata

  • Download URL: shellcord-0.2.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0a2 CPython/3.8.10 Linux/5.11.0-1028-azure

File hashes

Hashes for shellcord-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e702f6381dbba48d5df39d8145994e1d3c2ba986b9fb9d468f1c398151e29438
MD5 1457b9869abdc82fc6c7302f1fbbd12d
BLAKE2b-256 8dde70733f83ed1f569c40f6d5f23db273de75e51c916a00ca905fd43eac74ab

See more details on using hashes here.

File details

Details for the file shellcord-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: shellcord-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0a2 CPython/3.8.10 Linux/5.11.0-1028-azure

File hashes

Hashes for shellcord-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c01c2bf5834a06151da59c55cffe13bf8dfe7f20c06083f11ff38bbbdf1e41f
MD5 d240ccbc528867a6a385ab74e2cc4782
BLAKE2b-256 7ee0063fa7815f2b7e3b43817bdb1bdeb063ffbea56284cc46302e7e027c6ab1

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