Useful xonsh-shell commands/alias functions
Project description
Useful xonsh-shell commands/alias/completer functions
Installation
To install use pip:
xpip install xontrib-commands
# or: xpip install -U git+https://github.com/jnoortheen/xontrib-commands
Usage
xontrib load commands
building alias
Use xontrib_commands.Command
to build arger dispatcher
for your functions.
from xontrib_commands import Command
@Command.reg
def record_stats(pkg_name=".", path=".local/stats.txt"):
stat = $(scc @(pkg_name))
echo @($(date) + stat) | tee -a @(path)
Now a full CLI is ready
$ record-stats --help
usage: xonsh [-h] [-p PKG_NAME] [-a PATH]
optional arguments:
-h, --help show this help message and exit
-p PKG_NAME, --pkg-name PKG_NAME
-a PATH, --path PATH
Commands
- The following commands are available once the xontrib is loaded.
1. reload-mods
usage: reload-mods [-h] name
Reload any python module in the current xonsh session.
Helpful during development.
positional arguments:
name Name of the module/package to reload. Giving partial names matches all the nested modules.
optional arguments:
-h, --help show this help message and exit
Examples
-------
$ reload-mods xontrib
- this will reload all modules imported that starts with xontrib name
Notes
-----
Please use
`import module` or `import module as mdl` patterns
Using
`from module import name`
will not reload the name imported
2. report-key-bindings
usage: report-key-bindings [-h]
Show current Prompt-toolkit bindings in a nice table format
optional arguments:
-h, --help show this help message and exit
3. dev
dev v1.0.0 (nuclear v1.1.10) - A command to cd into a directory. (Default action)
Usage:
dev [COMMAND] [OPTIONS] [NAME]
Arguments:
[NAME] - name of the folder to cd into. This searches for names under $PROJECT_PATHS or the ones registered with ``dev add``
Options:
--help [SUBCOMMANDS...] - Display this help and exit
Commands:
add - Register the current folder to dev command.
When using this, it will get saved in a file, also that is used during completions.
ls - Show currently registered paths
load-env FILE - Load environment variables from the given file into Xonsh session
Using https://github.com/theskumar/python-dotenv
Run "dev COMMAND --help" for more information on a command.
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
xontrib-commands-0.3.4.tar.gz
(10.2 kB
view details)
Built Distribution
File details
Details for the file xontrib-commands-0.3.4.tar.gz
.
File metadata
- Download URL: xontrib-commands-0.3.4.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.2 Darwin/21.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79aeab39db186054e5dca0f6c4db897d14c3c2c883decb40485cced76b51cee2 |
|
MD5 | 6e4af82fa8b61c96e6712db5721a4162 |
|
BLAKE2b-256 | 952c24ee27ed8b49b959b232ea919712f1b7fca7017ea018894be2e101f529cf |
File details
Details for the file xontrib_commands-0.3.4-py3-none-any.whl
.
File metadata
- Download URL: xontrib_commands-0.3.4-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.2 Darwin/21.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee0b86e5207304945cf29d972997afef9b1603a65e54f6922da07ef36981ecd9 |
|
MD5 | 4b33166b18ac5a576bb53e0d293d9e59 |
|
BLAKE2b-256 | 45dae4312c1428fe7f88a7fc25b3e9f642fb325a8ba980a5a565b887103c7e26 |