feat: use pushd instead of cd
This commit is contained in:
parent
453ddb4b06
commit
7024c45a04
2 changed files with 2 additions and 1 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
`h repo-name` resolves the path to `repo-name` and changes the current working directory to it.
|
`h repo-name` resolves the path to `repo-name` and changes the current working directory to it.
|
||||||
`h https://git.example.com/dadada/example.git` clones the repo `example` into `~/code/git.example.com/dadada/example` and changes the current working directory to it.
|
`h https://git.example.com/dadada/example.git` clones the repo `example` into `~/code/git.example.com/dadada/example` and changes the current working directory to it.
|
||||||
In this example `~/code` is the path in which repos should be stored; it can be specified using `export REPO_CODE_ROOT=$HOME/code`.
|
In this example `~/code` is the path in which repos should be stored; it can be specified using `export REPO_CODE_ROOT=$HOME/code`.
|
||||||
|
To navigate back use `popd`.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ fn setup_shell(code_root: &Path) {
|
||||||
h() {{
|
h() {{
|
||||||
_h_dir=$(command repo resolve --root "{}" "$@")
|
_h_dir=$(command repo resolve --root "{}" "$@")
|
||||||
_h_ret=$?
|
_h_ret=$?
|
||||||
[ "$_h_dir" != "$PWD" ] && cd "$_h_dir"
|
[ "$_h_dir" != "$PWD" ] && pushd "$_h_dir"
|
||||||
return $_h_ret
|
return $_h_ret
|
||||||
}}
|
}}
|
||||||
"#,
|
"#,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue