Package for managing UI commands in text package in bash syntax
Project description
This is a simple Python package I used to test packaging mechanism in Python. Also it provides a possibility to manage your UI text commands in bash-like syntax like :open last.org
or delete 1
.
from text_actions import ui_action
actions = []
@ui_action(actions, 'd', 'delete')
def delete_action(state, index='-1'):
index = int(index)
if index < 0:
index += len(state.activities)
state.activities = state.activities[:index] + state.activities[index + 1:]
This code will create a library of commands inside the actions variable, that you can use as argument in apply_action
. First argument is always the state of application, other arguments are receivied from user's command. You probably should not worry about cast exceptions, I usually catch them in the UI code.
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
File details
Details for the file text-actions-girvel-0.0.2.tar.gz
.
File metadata
- Download URL: text-actions-girvel-0.0.2.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da1efd08df89a92079e6f5522e1d603e67605f8c5c4588dcf85ea01149d09680 |
|
MD5 | c0724155d624b217e445fae5cac891c8 |
|
BLAKE2b-256 | 2548afed577a9a1ba47ce805e04f3f70ed1e7990932304ae9fc4a0eb63743d3d |
File details
Details for the file text_actions_girvel-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: text_actions_girvel-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44889d82714e4db7a6b9121e4a8e3675194e370996d53b52445da4dc5d739922 |
|
MD5 | ea8717af56ea4efe068015d987291683 |
|
BLAKE2b-256 | efcb0a9cd5a72af35b4ec81e97fde35b0b5506a0597e9ad03e24eb8c30929f20 |