Skip to main content

It's kinda like Bash except it causes severe brain damage because it's actually a Python REPL.

Project description

Concussion Shell

It's kinda like Bash except it causes severe brain damage because it's actually a Python REPL.

Usage

$ pip install concussion
$ concussion
>>> cat + README.md | head + -n + 4
# Concussion Shell

It's kinda like Bash except it causes severe brain damage because it's actually
a Python REPL.

How it works

Everything is implemented using horrific operator overloads.

Since the commands can't be executed while they're being constructed, commands are instead executed when stringified using repr(), which works nicely with Python's interactive console.

Python doesn't support building commands from adjacent identifiers, so Concussion uses the + operator to join arguments for a command.

>>> echo + hello + world
hello world

Notice that none of these variables were never defined. Concussion uses a custom dictionary for the local variable scope such that any undefined variables create a new string-like object, which helps to improve readability.

You can pipe commands using the standard | pipe operator.

>>> ls + -l | less
# less is broken because I can't be bothered to make my shell look like a TTY
# so the output is incorrect

To create shell aliases, you simply use Python variable assignments

>>> # This makes for an epic prank
>>> bash = concussion
>>> bash
Concussion shell...

Because && and || are not supported in Python, use the and and or keywords instead.

>>> false or echo + hi
>>> false and echo + hi
hi
>>> true or echo + hi
hi
>>> true and echo + hi

You can also do file redirection like in Bash

>>> echo + hi > hi.txt
>>> cat < hi.txt
hi
>>> echo + "hi again" >> hi.txt  # append
>>> cat < hi.txt
hi
hi again

Because working with regular strings or pathlib's Path objects is tedious in a shell-like environment, Concussion provides its own CursedPath object, which simplifies many aspects of string manipulation.

>>> str(path/to/some-file.txt)
"['path/to/some-file.txt']"

Note that the /, - and . operators all result in string joining.

in order to path to files from the root of the file system, a _ can be used before the leading /, since a leading / in Python produces a SyntaxError.

>>> _/usr/bin/sl
# [epic train ASCII art]

Setting concussion as your default shell

This will almost definitely break your system.

$ sudo chsh --shell $(which concussion)
...

Known issues

  • Currently all stderr goes directly to this process's stderr, and it cannot be redirected. Maybe I'll implement this at some point.

  • Currently no support for executing tasks asynchronously. Perhaps I could use β to signify this since it looks kinda like an & but is a valid identifier.

  • Many programs don't work nicely because they think they're not running in a terminal.

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

concussion-0.2.2.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

concussion-0.2.2-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file concussion-0.2.2.tar.gz.

File metadata

  • Download URL: concussion-0.2.2.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1024-azure

File hashes

Hashes for concussion-0.2.2.tar.gz
Algorithm Hash digest
SHA256 4cf3c72968e97bf4984d0562ae69196f6db223a2885b3b9c3da0c3f827cfb4fa
MD5 d84a26f67a5b410b26cb9febd6f763e4
BLAKE2b-256 325671424fb8854134b956bc3b9c4e119a11193b1d18da4bdc3c52f974621505

See more details on using hashes here.

File details

Details for the file concussion-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: concussion-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1024-azure

File hashes

Hashes for concussion-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 133f8a98a339a833ff85159ff3f6a26e1e7a9d40bb7441e96e0cffb3353565be
MD5 da36f4b50e4e45fc9df73fcc47cbf779
BLAKE2b-256 311f2ed6bfce752acce42cb5332e2c8c25f11da047ba888210567d54bce74eac

See more details on using hashes here.

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