<p align="center">
<code>cd</code> to any path without escaping in <a href="https://xon.sh">xonsh shell</a>.
<br/>
Replaces <code>cd </code> at the start of a line with a <a href="https://xon.sh/tutorial_macros.html#subprocess-macros">subprocess macro</a> <code>cd! </code>
</p>
<p align="center">
If you like the idea click ⭐ on the repo and stay tuned.
</p>
## Install
```xsh
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
```xonsh
$XONTRIBS_AUTOLOAD_DISABLED = {"cd", }
```
## Configure
Set the following environment variables in your profile to enable __extra options__ (disabled by default):
- `$XONTRIB_CD_ALTSYMLINKFLAG = True` to pass `-p`, `-f`, or `-s` flags (in addition to `-P`) to follow symlinks
- `$XONTRIB_CD_ALTSYMLINKFUNC = True` to use `cdp`, `cdf`, or `cds` (in addition to `cd -P`) to follow symlinks
- `$XONTRIB_CD_SYMLINKAlWAYSON = True` to make `cd` always follow symlinks (always pass `-P`)
- `$XONTRIB_CD_LASTCMD = True` to make `cd` also 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]/`)
```xsh
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](https://github.com/xonsh/xonsh/issues/5020), 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 1` will fail since `cd` is replaced with `cd!`, 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](https://github.com/xonsh/xontrib-cookiecutter) based on the idea of hooking into the command line input as implemented in [xontrib-sh](https://github.com/anki-code/xontrib-sh)
Raw data
{
"_id": null,
"home_page": "https://github.com/eugenesvk/xontrib-cd",
"name": "xontrib-cd",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "xontrib, xonsh",
"author": "Evgeny",
"author_email": "es.bugzilla@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9d/fd/4235e9847746b979c0a5ccc2d085f000975f63c72c625d4604461c71f0f8/xontrib_cd-0.3.1.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n<code>cd</code> to any path without escaping in <a href=\"https://xon.sh\">xonsh shell</a>.\n<br/>\nReplaces <code>cd </code> at the start of a line with a <a href=\"https://xon.sh/tutorial_macros.html#subprocess-macros\">subprocess macro</a> <code>cd! </code> \n</p>\n\n<p align=\"center\"> \nIf you like the idea click \u2b50 on the repo and stay tuned.\n</p>\n\n\n## Install\n\n```xsh\nxpip install xontrib-cd\n# or: xpip install -U git+https://github.com/eugenesvk/xontrib-cd\n```\n\nThis xontrib will get loaded automatically for interactive sessions; to stop this, set\n\n```xonsh\n$XONTRIBS_AUTOLOAD_DISABLED = {\"cd\", }\n```\n\n## Configure\n\nSet the following environment variables in your profile to enable __extra options__ (disabled by default):\n\n - `$XONTRIB_CD_ALTSYMLINKFLAG = True` to pass `-p`, `-f`, or `-s` flags (in addition to `-P`) to follow symlinks\n - `$XONTRIB_CD_ALTSYMLINKFUNC = True` to use `cdp`, `cdf`, or `cds` (in addition to `cd -P`) to follow symlinks\n - `$XONTRIB_CD_SYMLINKAlWAYSON = True` to make `cd` always follow symlinks (always pass `-P`)\n - `$XONTRIB_CD_LASTCMD = True` to make `cd` also work when it's the last command in a multi-command line\n\n\n## Use\n\nUse `cd` as usual, but without the fear of copying&pasting arbitrary paths (e.g. `.../space separated/` or `.../[bracketed]/`)\n\n```xsh\nxontrib load cd\ncd ~/[Path] With Spaces\t# equivalent to 'cd! ~/[Path] With Spaces'\ncd C:/Program Files \t# equivalent to 'cd! C:/Program Files'\ncd -P ~/SymlinkTo \t# follow symlinks, equivalent to 'cd -P! ~/SymlinkTo'\n```\n\nAdd a space before ` cd` to disable adding `!`\n\n## Known issues\n\n- Xontrib autoload can't be disabled and prevents user configured environment vars from being read on time due to a [xonsh bug](https://github.com/xonsh/xonsh/issues/5020), 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`\n- Multiple commands per line like `cd ~; echo 1` will fail since `cd` is replaced with `cd!`, and everything after `!` is treated as a single string argument, ignoring the `;` separators\n- But `echo 1; cd ~` will work with `$XONTRIB_CD_LASTCMD`\n\n## Credits\n\nThis package was created with [xontrib cookiecutter template](https://github.com/xonsh/xontrib-cookiecutter) based on the idea of hooking into the command line input as implemented in [xontrib-sh](https://github.com/anki-code/xontrib-sh)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "cd to any path without escaping in xonsh shell: cd ~/[te] st",
"version": "0.3.1",
"project_urls": {
"Code": "https://github.com/eugenesvk/xontrib-cd",
"Documentation": "https://github.com/eugenesvk/xontrib-cd/blob/master/ReadMe.md",
"Homepage": "https://github.com/eugenesvk/xontrib-cd",
"Issue tracker": "https://github.com/eugenesvk/xontrib-cd/issues",
"Repository": "https://github.com/eugenesvk/xontrib-cd"
},
"split_keywords": [
"xontrib",
" xonsh"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ea6c7738006a526426f7d3b2518caf7a1958508d83da83b6c7f482e77061ef41",
"md5": "9619d5993e89dec347c0644969908dde",
"sha256": "e5bf94321cd21e5961c61fc8915d6f4f3c29029bbb3910a460c571e0f0b25f7c"
},
"downloads": -1,
"filename": "xontrib_cd-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9619d5993e89dec347c0644969908dde",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 4492,
"upload_time": "2024-07-18T11:36:58",
"upload_time_iso_8601": "2024-07-18T11:36:58.411461Z",
"url": "https://files.pythonhosted.org/packages/ea/6c/7738006a526426f7d3b2518caf7a1958508d83da83b6c7f482e77061ef41/xontrib_cd-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9dfd4235e9847746b979c0a5ccc2d085f000975f63c72c625d4604461c71f0f8",
"md5": "13bdeca3b84ea18c9ac4da25cd3d70bd",
"sha256": "ed1b1f2dbc896acc66345411567adc3f34209ad24eabec239e86d5a8bfc8b2be"
},
"downloads": -1,
"filename": "xontrib_cd-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "13bdeca3b84ea18c9ac4da25cd3d70bd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 3582,
"upload_time": "2024-07-18T11:37:00",
"upload_time_iso_8601": "2024-07-18T11:37:00.185460Z",
"url": "https://files.pythonhosted.org/packages/9d/fd/4235e9847746b979c0a5ccc2d085f000975f63c72c625d4604461c71f0f8/xontrib_cd-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-18 11:37:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "eugenesvk",
"github_project": "xontrib-cd",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "xontrib-cd"
}