cd to any path without escaping in xonsh shell.
Replaces cd at the start of a line with a subprocess macro cd!
If you like the idea click ⭐ on the repo and stay tuned.
Install
xpip install xontrib-cd
# or: xpip install -U git+https://github.com/eugenesvk/xontrib-cd
This xontrib will get loaded automatically for interactive sessions; to stop this, set
$XONTRIBS_AUTOLOAD_DISABLED = {"cd", }
Configure
Set the following environment variables in your profile to enable extra options (disabled by default):
$XONTRIB_CD_ALTSYMLINKFLAG = Trueto pass-p,-f, or-sflags (in addition to-P) to follow symlinks$XONTRIB_CD_ALTSYMLINKFUNC = Trueto usecdp,cdf, orcds(in addition tocd -P) to follow symlinks$XONTRIB_CD_SYMLINKAlWAYSON = Trueto makecdalways follow symlinks (always pass-P)$XONTRIB_CD_LASTCMD = Trueto makecdalso work when it's the last command in a multi-command line
Use
Use cd as usual, but without the fear of copying&pasting arbitrary paths (e.g. .../space separated/ or .../[bracketed]/)
xontrib load cd
cd ~/[Path] With Spaces # equivalent to 'cd! ~/[Path] With Spaces'
cd C:/Program Files # equivalent to 'cd! C:/Program Files'
cd -P ~/SymlinkTo # follow symlinks, equivalent to 'cd -P! ~/SymlinkTo'
Add a space before cd to disable adding !
Known issues
- Xontrib autoload can't be disabled and prevents user configured environment vars from being read on time due to a xonsh bug, so if you want to change the default configs via env vars, install the deauto branch
xpip install -U git+https://github.com/eugenesvk/xontrib-cd@deauto - Multiple commands per line like
cd ~; echo 1will fail sincecdis replaced withcd!, and everything after!is treated as a single string argument, ignoring the;separators - But
echo 1; cd ~will work with$XONTRIB_CD_LASTCMD
Credits
This package was created with xontrib cookiecutter template based on the idea of hooking into the command line input as implemented in xontrib-sh
Metadata
Release files for xontrib-cd 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xontrib_cd-0.3.1.tar.gz | 3.6 kB | Without provenance | Details for xontrib_cd-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xontrib_cd-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for xontrib_cd-0.3.1-py3-none-any.whl |
Total release size: 8.1 kB
Release files / xontrib_cd-0.3.1.tar.gz
| Download URL | xontrib_cd-0.3.1.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed1b1f2dbc896acc66345411567adc3f34209ad24eabec239e86d5a8bfc8b2be
|
|
BLAKE2b-256 checksum How to use checksums |
9dfd4235e9847746b979c0a5ccc2d085f000975f63c72c625d4604461c71f0f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / xontrib_cd-0.3.1-py3-none-any.whl
| Download URL | xontrib_cd-0.3.1-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5bf94321cd21e5961c61fc8915d6f4f3c29029bbb3910a460c571e0f0b25f7c
|
|
BLAKE2b-256 checksum How to use checksums |
ea6c7738006a526426f7d3b2518caf7a1958508d83da83b6c7f482e77061ef41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Security for xontrib-cd 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.