A shell widget for textual.
Project description
Textual-Shell
Welcome to the Textual-Shell documentation! This is an addon for the Textual framework.
What is Textual-Shell?
It is a collection of widgets that can be used to build a custom shell application. It draws inspiration from the cmd2 and prompt-toolkit libraries.
Quick Start
Install it with:
pip install textual-shell
import os
from textual.app import ComposeResult
from textual.containers import Grid, Container
from textual.widgets import Header, Footer
from textual_shell.app import BaseShellApp
from textual_shell.commands import Bash, Clear, Help, Jobs, Python, Set
from textual_shell.widgets import (
Shell,
CommandList,
ConsoleLog,
JobManager,
SettingsDisplay,
)
class BasicShell(BaseShellApp):
CSS = """
#app-grid {
grid-size: 3;
grid-rows: 1fr;
grid-columns: 20 2fr 1fr;
width: 1fr;
}
"""
theme = 'tokyo-night'
CONFIG_PATH = os.path.join(os.getcwd(), '.config.yaml')
cmd_list = [Bash(), Clear(), Help(), Jobs(), Python(), Set(CONFIG_PATH)]
command_names = [cmd.name for cmd in cmd_list]
def compose(self) -> ComposeResult:
yield Header()
yield Footer()
yield Grid(
CommandList(self.command_names),
Shell(
self.cmd_list,
prompt='prompt <$ '
),
SettingsDisplay(self.CONFIG_PATH),
Container(),
ConsoleLog(self.CONFIG_PATH),
JobManager(),
id='app-grid'
)
if __name__ == '__main__':
BasicShell().run()
Below is an example config file. The descriptions are used by the help command. The Set command can be used to change these values. The SettingsDisplay widget will load the settings and the corresponding values into a DataTable widget.
Server:
description: An example server config.
host:
description: IP of the server.
value: 127.0.0.1
port:
description: The open port.
value: 8000
Logging:
description: Config for logging.
logdir:
description: The directory to write log files too.
value: /var/log/app
log_format:
description: The Format for the log records.
value: '\%(levelname)s\t\%(message)'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file textual_shell-0.9.91.tar.gz.
File metadata
- Download URL: textual_shell-0.9.91.tar.gz
- Upload date:
- Size: 701.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39014612acd2a1a24fb6f83343dda997d9feb3d9e3db45d0f5281e08aed0fb0a
|
|
| MD5 |
6d9a2fc9d2f798b2808ac08b490ff66a
|
|
| BLAKE2b-256 |
1cddfee35d112f5a39934307d0d7c17a824fc744c8daef2c12c8d041b77720d8
|
Provenance
The following attestation bundles were made for textual_shell-0.9.91.tar.gz:
Publisher:
publish-ci.yml on Jason-Lawrence/textual-shell
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
textual_shell-0.9.91.tar.gz -
Subject digest:
39014612acd2a1a24fb6f83343dda997d9feb3d9e3db45d0f5281e08aed0fb0a - Sigstore transparency entry: 164289010
- Sigstore integration time:
-
Permalink:
Jason-Lawrence/textual-shell@806d7dd84b977463ee1b4485b3f977028951a4c6 -
Branch / Tag:
refs/tags/v0.9.91 - Owner: https://github.com/Jason-Lawrence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-ci.yml@806d7dd84b977463ee1b4485b3f977028951a4c6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file textual_shell-0.9.91-py3-none-any.whl.
File metadata
- Download URL: textual_shell-0.9.91-py3-none-any.whl
- Upload date:
- Size: 34.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d68ee6ff404fd8052c3404ca51fd6b52f2b282ea847b23547a5ad8337bb40f1f
|
|
| MD5 |
e7b4f69ad3f973c145d74b25d0b6f915
|
|
| BLAKE2b-256 |
49ee220a93ca05872cf52268094a69af686a11af602dc87c869196c96bed5cd3
|
Provenance
The following attestation bundles were made for textual_shell-0.9.91-py3-none-any.whl:
Publisher:
publish-ci.yml on Jason-Lawrence/textual-shell
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
textual_shell-0.9.91-py3-none-any.whl -
Subject digest:
d68ee6ff404fd8052c3404ca51fd6b52f2b282ea847b23547a5ad8337bb40f1f - Sigstore transparency entry: 164289012
- Sigstore integration time:
-
Permalink:
Jason-Lawrence/textual-shell@806d7dd84b977463ee1b4485b3f977028951a4c6 -
Branch / Tag:
refs/tags/v0.9.91 - Owner: https://github.com/Jason-Lawrence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-ci.yml@806d7dd84b977463ee1b4485b3f977028951a4c6 -
Trigger Event:
release
-
Statement type: