<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": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "xontrib,xonsh",
"author": "Evgeny",
"author_email": "es.bugzilla@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/11/75/50b15c2a53ee67aa0a430e96bf37244525cc4bd161c8c0b3bbb1eaa16559/xontrib_cd-0.3.0.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.0",
"split_keywords": [
"xontrib",
"xonsh"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "659afe57d75d9f7245981936d8be911b8bb1ec131344ea43cd6dff9a1788fe22",
"md5": "3963c98c0d77efac67fa2dda0cf0bb9d",
"sha256": "4825addbb987c485c17e7740866bf77999e3890952a2bd759724e0ac48673f04"
},
"downloads": -1,
"filename": "xontrib_cd-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3963c98c0d77efac67fa2dda0cf0bb9d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4485,
"upload_time": "2023-03-12T18:56:55",
"upload_time_iso_8601": "2023-03-12T18:56:55.582346Z",
"url": "https://files.pythonhosted.org/packages/65/9a/fe57d75d9f7245981936d8be911b8bb1ec131344ea43cd6dff9a1788fe22/xontrib_cd-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "117550b15c2a53ee67aa0a430e96bf37244525cc4bd161c8c0b3bbb1eaa16559",
"md5": "d73d6d9044b6488f3c0af8607a3afb4e",
"sha256": "5f61a9049385e18e37594d8b1c7af461dbe27fabd2d9c55168e4ff3bd332f213"
},
"downloads": -1,
"filename": "xontrib_cd-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "d73d6d9044b6488f3c0af8607a3afb4e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3572,
"upload_time": "2023-03-12T18:56:57",
"upload_time_iso_8601": "2023-03-12T18:56:57.386205Z",
"url": "https://files.pythonhosted.org/packages/11/75/50b15c2a53ee67aa0a430e96bf37244525cc4bd161c8c0b3bbb1eaa16559/xontrib_cd-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-12 18:56:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "eugenesvk",
"github_project": "xontrib-cd",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "xontrib-cd"
}