https://github.com/ericktucto/xontrib-add-variable
This package allow add new variable.
https://github.com/ericktucto/xontrib-add-variable
extension python xonsh xontrib
Last synced: 10 months ago
JSON representation
This package allow add new variable.
- Host: GitHub
- URL: https://github.com/ericktucto/xontrib-add-variable
- Owner: ericktucto
- License: mit
- Created: 2018-07-17T23:34:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-30T22:55:16.000Z (about 7 years ago)
- Last Synced: 2024-11-14T22:36:42.531Z (about 1 year ago)
- Topics: extension, python, xonsh, xontrib
- Language: Python
- Homepage:
- Size: 607 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
*********************
Xontrib Add Variable
*********************
Version number: 1.1.1
Author: `Erick Tucto`_
Overview
########
This package allow add new variable to ``$PROMPT_FIELDS`` and
create new aliases.
Installation / Usage
####################
1. To install use pip
.. code-block:: bash
pip install xontrib-add-variable
2. Add on ``~/.xonshrc``
Now you can create new variables to $PROMPT on ``~/.xonsh/add_variable.xsh``,
also create new aliases, please see `Example`_ or my `wiki`_
.. code:: python
:number-lines:
xontrib load add_variable
Contributing
############
1. `Erick Tucto`_
Example
#######
1. On ``~/.xonsh/add_variable.xsh`` or ``~/.xonsh/add_variable.py``
.. code:: python
:number-lines:
from time import strftime
from xontrib.add_variable.decorators import variable
@variable
def timeNow():
return strftime('%H:%M:%S')
2. On ``~/.xonshrc``
.. code:: python
:number-lines:
xontrib load add_variable
$RIGHT_PROMPT = '{timeNow}'
3. See image
|Terminal|
Credits
#######
This package was created with Cookiecutter_ and the xontrib_ template
.. |Terminal| image:: https://raw.githubusercontent.com/ErickTucto/xontrib-add-variable/master/docs/terminal.png
:width: 600px
:alt: terminal.png
.. _`Erick Tucto`: https://github.com/ErickTucto
.. _`issue#1`: https://github.com/ErickTucto/xontrib-add-variable/issues/1
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _xontrib: https://github.com/laerus/cookiecutter-xontrib
.. _wiki: https://github.com/ErickTucto/xontrib-add-variable/wiki