concussion


Nameconcussion JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryIt's kinda like Bash except it causes severe brain damage because it's actually a Python REPL.
upload_time2024-03-01 09:29:33
maintainer
docs_urlNone
authorMiguel Guthridge
requires_python>=3.11,<4.0
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" + "5"
# 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
```

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

Since there is no way to create a Python identifier for every possible
executable that could be run, users can also type their own shell prompt:
`Ṩ +`. Note that this isn't a dollar sign, but is rather a Latin capital
letter S with dot below and dot above (`U+1E68`), since that is the closest
valid Python identifier I could get to the traditional `$` dollar sign. Since
`Ṩ` is difficult to type, `S` is also available as a substitute.

```py
>>> Ṩ + "uname"
Linux
```

Because of Python's order of operations, you need to group arguments for
commands within a `tuple` or `list` for everything after the first command
in a pipeline if the first argument isn't a variable.

```py
>>> cat + "README.md" | ("head", "-n", "5")
# Concussion Shell

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

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

* Pipes break frequently. I think there's a bug somewhere in the code for
  handling this but I don't know what.

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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "concussion",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Miguel Guthridge",
    "author_email": "hello@miguelguthridge.com",
    "download_url": "https://files.pythonhosted.org/packages/d5/bf/3648c39fe4c077318b510acdc0025fadf091b80b18f1679df548a2c15f98/concussion-0.1.0.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\" + \"5\"\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\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\nSince there is no way to create a Python identifier for every possible\nexecutable that could be run, users can also type their own shell prompt:\n`\u1e68 +`. Note that this isn't a dollar sign, but is rather a Latin capital\nletter S with dot below and dot above (`U+1E68`), since that is the closest\nvalid Python identifier I could get to the traditional `$` dollar sign. Since\n`\u1e68` is difficult to type, `S` is also available as a substitute.\n\n```py\n>>> \u1e68 + \"uname\"\nLinux\n```\n\nBecause of Python's order of operations, you need to group arguments for\ncommands within a `tuple` or `list` for everything after the first command\nin a pipeline if the first argument isn't a variable.\n\n```py\n>>> cat + \"README.md\" | (\"head\", \"-n\", \"5\")\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## 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* Pipes break frequently. I think there's a bug somewhere in the code for\n  handling this but I don't know what.\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.1.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "82a8cf2304da42c2414900249ff5052005e237c45b7d3d25b601d54c0354aa47",
                "md5": "8accbb8cd9216b23c62089b677afbf5e",
                "sha256": "8dc68c8421db1bd340ea4c6fac985c07b3f67f066b61e5ce6b0d6732ad70d709"
            },
            "downloads": -1,
            "filename": "concussion-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8accbb8cd9216b23c62089b677afbf5e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 8150,
            "upload_time": "2024-03-01T09:29:30",
            "upload_time_iso_8601": "2024-03-01T09:29:30.987471Z",
            "url": "https://files.pythonhosted.org/packages/82/a8/cf2304da42c2414900249ff5052005e237c45b7d3d25b601d54c0354aa47/concussion-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d5bf3648c39fe4c077318b510acdc0025fadf091b80b18f1679df548a2c15f98",
                "md5": "97dfcef2921d096e36bc2fb359dcda26",
                "sha256": "ef8d47051ff1ff7456cc88172b1c8ac8fc2b224f66c28160b3658fbe52efe42d"
            },
            "downloads": -1,
            "filename": "concussion-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "97dfcef2921d096e36bc2fb359dcda26",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 6226,
            "upload_time": "2024-03-01T09:29:33",
            "upload_time_iso_8601": "2024-03-01T09:29:33.102869Z",
            "url": "https://files.pythonhosted.org/packages/d5/bf/3648c39fe4c077318b510acdc0025fadf091b80b18f1679df548a2c15f98/concussion-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-01 09:29:33",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "concussion"
}
        
Elapsed time: 0.17516s