concussion


Nameconcussion JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://github.com/MaddyGuthridge/concussion
SummaryIt's kinda like Bash except it causes severe brain damage because it's actually a Python REPL.
upload_time2024-07-26 07:34:22
maintainerNone
docs_urlNone
authorMaddy Guthridge
requires_python<4.0,>=3.11
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Concussion Shell

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

## Usage

```txt
$ 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.

```py
>>> 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.

```py
>>> 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

```py
>>> # 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.

```py
>>> 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

```py
>>> 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.

```py
>>> 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`.

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

## Setting concussion as your default shell

This will almost definitely break your system.

```sh
$ 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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/MaddyGuthridge/concussion",
    "name": "concussion",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": null,
    "author": "Maddy Guthridge",
    "author_email": "hello@maddyguthridge.com",
    "download_url": "https://files.pythonhosted.org/packages/32/56/71424fb8854134b956bc3b9c4e119a11193b1d18da4bdc3c52f974621505/concussion-0.2.2.tar.gz",
    "platform": null,
    "description": "# Concussion Shell\n\nIt's kinda like Bash except it causes severe brain damage because it's actually\na Python REPL.\n\n## Usage\n\n```txt\n$ pip install concussion\n$ concussion\n>>> cat + README.md | head + -n + 4\n# Concussion Shell\n\nIt's kinda like Bash except it causes severe brain damage because it's actually\na Python REPL.\n```\n\n## How it works\n\nEverything is implemented using horrific operator overloads.\n\nSince the commands can't be executed while they're being constructed, commands\nare instead executed when stringified using `repr()`, which works nicely with\nPython's interactive console.\n\nPython doesn't support building commands from adjacent identifiers, so\nConcussion uses the `+` operator to join arguments for a command.\n\n```py\n>>> echo + hello + world\nhello world\n```\n\nNotice that none of these variables were never defined. Concussion uses a custom\ndictionary for the local variable scope such that any undefined variables\ncreate a new string-like object, which helps to improve readability.\n\nYou can pipe commands using the standard `|` pipe operator.\n\n```py\n>>> ls + -l | less\n# less is broken because I can't be bothered to make my shell look like a TTY\n# so the output is incorrect\n```\n\nTo create shell aliases, you simply use Python variable assignments\n\n```py\n>>> # This makes for an epic prank\n>>> bash = concussion\n>>> bash\nConcussion shell...\n```\n\nBecause `&&` and `||` are not supported in Python, use the `and` and `or`\nkeywords instead.\n\n```py\n>>> false or echo + hi\n>>> false and echo + hi\nhi\n>>> true or echo + hi\nhi\n>>> true and echo + hi\n```\n\nYou can also do file redirection like in Bash\n\n```py\n>>> echo + hi > hi.txt\n>>> cat < hi.txt\nhi\n>>> echo + \"hi again\" >> hi.txt  # append\n>>> cat < hi.txt\nhi\nhi again\n```\n\nBecause working with regular strings or `pathlib`'s `Path` objects is tedious\nin a shell-like environment, Concussion provides its own `CursedPath` object,\nwhich simplifies many aspects of string manipulation.\n\n```py\n>>> str(path/to/some-file.txt)\n\"['path/to/some-file.txt']\"\n```\n\nNote that the `/`, `-` and `.` operators all result in string joining.\n\nin order to path to files from the root of the file system, a `_` can be used\nbefore the leading `/`, since a leading `/` in Python produces a `SyntaxError`.\n\n```py\n>>> _/usr/bin/sl\n# [epic train ASCII art]\n```\n\n## Setting concussion as your default shell\n\nThis will almost definitely break your system.\n\n```sh\n$ sudo chsh --shell $(which concussion)\n...\n```\n\n## Known issues\n\n* Currently all stderr goes directly to this process's stderr, and it cannot be\n  redirected. Maybe I'll implement this at some point.\n\n* Currently no support for executing tasks asynchronously. Perhaps I could use\n  `\u03b2` to signify this since it looks kinda like an `&` but is a valid\n  identifier.\n\n* Many programs don't work nicely because they think they're not running in a\n  terminal.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "It's kinda like Bash except it causes severe brain damage because it's actually a Python REPL.",
    "version": "0.2.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/MaddyGuthridge/concussion/issues",
        "Homepage": "https://github.com/MaddyGuthridge/concussion",
        "Online Documentation": "https://github.com/MaddyGuthridge/concussion",
        "Repository": "https://github.com/MaddyGuthridge/concussion"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "311f2ed6bfce752acce42cb5332e2c8c25f11da047ba888210567d54bce74eac",
                "md5": "da36f4b50e4e45fc9df73fcc47cbf779",
                "sha256": "133f8a98a339a833ff85159ff3f6a26e1e7a9d40bb7441e96e0cffb3353565be"
            },
            "downloads": -1,
            "filename": "concussion-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "da36f4b50e4e45fc9df73fcc47cbf779",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 11010,
            "upload_time": "2024-07-26T07:34:20",
            "upload_time_iso_8601": "2024-07-26T07:34:20.762159Z",
            "url": "https://files.pythonhosted.org/packages/31/1f/2ed6bfce752acce42cb5332e2c8c25f11da047ba888210567d54bce74eac/concussion-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "325671424fb8854134b956bc3b9c4e119a11193b1d18da4bdc3c52f974621505",
                "md5": "d84a26f67a5b410b26cb9febd6f763e4",
                "sha256": "4cf3c72968e97bf4984d0562ae69196f6db223a2885b3b9c3da0c3f827cfb4fa"
            },
            "downloads": -1,
            "filename": "concussion-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d84a26f67a5b410b26cb9febd6f763e4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 9433,
            "upload_time": "2024-07-26T07:34:22",
            "upload_time_iso_8601": "2024-07-26T07:34:22.070835Z",
            "url": "https://files.pythonhosted.org/packages/32/56/71424fb8854134b956bc3b9c4e119a11193b1d18da4bdc3c52f974621505/concussion-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-26 07:34:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MaddyGuthridge",
    "github_project": "concussion",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "concussion"
}
        
Elapsed time: 2.50169s