From 35703278aa1d22aec9d2034c3b045eb0bef59ecd Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sat, 17 Apr 2021 13:31:39 -0500 Subject: [PATCH] Add Set The asdf Package Version For A Single Shell as a unix til --- README.md | 3 ++- ...asdf-package-version-for-a-single-shell.md | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 unix/set-the-asdf-package-version-for-a-single-shell.md diff --git a/README.md b/README.md index 242108d..444247a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud). -_1116 TILs and counting..._ +_1117 TILs and counting..._ --- @@ -1093,6 +1093,7 @@ _1116 TILs and counting..._ - [Search History](unix/search-history.md) - [Search Man Page Descriptions](unix/search-man-page-descriptions.md) - [Securely Remove Files](unix/securely-remove-files.md) +- [Set The asdf Package Version For A Single Shell](unix/set-the-asdf-package-version-for-a-single-shell.md) - [Show A File Preview When Searching With FZF](unix/show-a-file-preview-when-searching-with-fzf.md) - [Show Disk Usage For The Current Directory](unix/show-disk-usage-for-the-current-directory.md) - [Show The Size Of Everything In A Directory](unix/show-the-size-of-everything-in-a-directory.md) diff --git a/unix/set-the-asdf-package-version-for-a-single-shell.md b/unix/set-the-asdf-package-version-for-a-single-shell.md new file mode 100644 index 0000000..9cb018a --- /dev/null +++ b/unix/set-the-asdf-package-version-for-a-single-shell.md @@ -0,0 +1,27 @@ +# Set The asdf Package Version For A Single Shell + +Generally when using [`asdf`](https://asdf-vm.com/), I set the global version +for a package/language to a good up-to-date default. And then I set `local` +versions for specific projects which get written to the `.tool-versions` file. + +There is another option that `asdf` supports for when you want to use a version +without it being so _sticky_. + +```bash +$ asdf shell postgres 12.3 + +$ psql --version +psql (PostgreSQL) 12.3 + +$ postgres --version +postgres (PostgreSQL) 12.3 +``` + +With the +[`shell`](https://asdf-vm.com/#/core-manage-versions?id=set-current-version) +command, I tell `asdf` to shim the specified package version just for this +shell instance. If I switch back to another tab or open a new one, neither of +them will have been impacted by this shell-constrained setting. + +This is handy for a one-off situation where you want to try something at a +specific version without impact the rest of your terminal session.