Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(install-path): add install-path config #284

Merged
merged 8 commits into from
Jul 27, 2023
Merged

feat(install-path): add install-path config #284

merged 8 commits into from
Jul 27, 2023

Conversation

Gankra
Copy link
Contributor

@Gankra Gankra commented Jul 21, 2023

fixes #235 and the most important part of #41

Also fixes the way we handle parse errors or dist-metadata (before we would just replace corrupt values with Default, which, is confusing).

Possible values include:

  • "CARGO_HOME": install to the user's cargo bins (default)
  • "~/some/subdir": install to the given subdir of the user's home dir
  • "$ENV_VAR/some/subdir": install to the given subdir of the given env var

Examples: "~/.my-app", "$MY_APP/", "$MY_APP/bin/"

If the resulting path doesn't exist, a directory will be created at its location.

All 3 of these settings will error out if required env vars aren't set:

  • "CARGO_HOME": first tries $CARGO_HOME, then $HOME
  • "~/subdir": tries $HOME
  • "$ENV_VAR/subdir": tries $ENV_VAR

(Note that $HOME/subdir is technically valid syntax, but won't behave the way you want,
because in powershell $HOME isn't a normal env var. Use ~/subdir and we'll handle these
details for you.)

Gankra added 3 commits July 21, 2023 12:47
Also fixes the way we handle parse errors or dist-metadata (before we would just replace corrupt values with Default, which, is confusing).

Possible values include:

* "CARGO_HOME": install to the user's cargo bins (default)
* "~/some/subdir": install to the given subdir of the user's home dir
* "$ENV_VAR/some/subdir": install to the given subdir of the given env var

Examples: "~/.my-app", "$MY_APP/", "$MY_APP/bin/"

If the resulting path doesn't exist, a directory will be created at its location.

All 3 of these settings will error out if required env vars aren't set:

* "CARGO_HOME": first tries $CARGO_HOME, then $HOME
* "~/subdir": tries $HOME
* "$ENV_VAR/subdir": tries $ENV_VAR

(Note that $HOME/subdir is technically valid syntax, but won't behave the way you want,
because in powershell $HOME isn't a normal env var. Use `~/subdir` and we'll handle these
details for you.)
Gankra added 2 commits July 24, 2023 14:42
This script is descended from rustup.sh, and they have way more people cleaning it up,
so let's snag the improvements.

* add shellcheck annotation (and fix issues)
* update platform detection
* properly handle variable detection with `set -u`
@Gankra Gankra force-pushed the neo-install-path branch from e98e66d to 89a1e74 Compare July 24, 2023 18:42
@Gankra Gankra marked this pull request as ready for review July 24, 2023 18:43
@Gankra Gankra mentioned this pull request Jul 24, 2023
@Gankra Gankra force-pushed the neo-install-path branch from d12367c to 4fd0d64 Compare July 26, 2023 17:06
Copy link
Contributor

@shadows-withal shadows-withal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only looking over the new templates, and i won't pretend to understand most of the stuff that goes on in the shell script, but it looks good to me, i have only nits as of this point

@Gankra Gankra merged commit 83c2595 into main Jul 27, 2023
@Gankra Gankra deleted the neo-install-path branch July 27, 2023 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

install-path customization
2 participants