Commit Graph

36 Commits

Author SHA1 Message Date
Victor Hugo Borja
e968fe6142 Subcommand-aware command line interface. 2019-11-27 12:17:17 -06:00
Daniel Perez
6523971b40 Check for bash before mksh 2019-03-31 20:44:49 +01:00
Daniel Perez
1d43a052fe
Merge pull request #480 from jonmast/add-shell-command
Add "shell" subcommand for setting versions in shell session
2019-03-20 19:02:59 +00:00
fallwith
2743bcb7f7 asdf.sh: comments for script path determination
Update `asdf.sh` to explain that `$_`, `${BASH_SOURCE[0]}`, and `$0`
are used by Korn, Bash, and Zsh (and others) to obtain the path to the
script, and what those special variables mean.
2019-03-20 11:49:04 -07:00
Jonathan Mast
9116e8453d
Add "shell" subcommand for setting versions in shell session
Add a "shell" command similar to the existing "global" and "local"
commands, which sets the version in an environment variable instead of
writing it to a file. This was inspired by the similar functionality in
rbenv.

It works by adding a wrapper function for the asdf command. It forwards
to a "sh-shell" command that returns the exports as shell code which is
then evaled by the wrapper. This is a little gross, but we need to run
the code in the shell context in order to set variables.

Resolves #378
2019-03-09 13:19:33 -05:00
fallwith
f8d843926a asdf.sh: support mksh
The mksh shell (and perhaps others too) will not be able to determine a
sourced script's path by looking at either `${BASH_SOURCE[0]}` or `$0`.

By capturing the value of `$_` as the very first thing the script does,
`asdf.sh` can use that as the input for `dirname` in order to determine
a value to use for `$ASDF_DIR`.

I have tested this change with mksh to confirm that it works, and have
also tested it with both bash and zsh to verify that neither of those
stop working.

This resolves the only compatibility issue I've ran into with asdf,
caused by mksh sourcing a script. All subsequent asdf usage involves an
asdf executable doing the sourcing, so it's bash to bash at that point.
2019-02-20 16:42:45 -08:00
Trevor Brown
ec5a280beb
Remove unused asdf shims directory 2018-11-27 10:18:05 -05:00
Jose Luis Salas
0a9cd676f4
Fix user shims stored now in ASDF_DATA_DIR 2018-09-24 17:47:49 +02:00
Jose Luis Salas
d1782f456e
Retrieve asdf_data_dir from environment variable 2018-09-16 18:39:21 +02:00
Jose Luis Salas
c86707c55f
Add config option to install plugins in $HOME/.asdf 2018-08-11 15:37:56 +02:00
Trevor Brown
a8ee53f5ad Disable shellcheck warning for echo statement. 2018-07-14 20:14:02 -04:00
Trevor Brown
bd8f7d9139 Print helpful error message when $ASDF_DIR is not a directory. 2018-07-14 20:01:09 -04:00
Trevor Brown
6d63496528 Switch from return to exit 1 when ASDF_DIR is not a dir. 2018-07-14 09:47:33 -04:00
rafaelliu
fb4fc79be7 Adding back check if directory exists 2018-06-06 19:06:13 -07:00
rafaelliu
ae31774c69 Fixes #333, there was a unnecessary cd issued (typo?) within a $ subshell on asdf.sh 2018-06-06 18:37:57 -07:00
James Hegedus
28cfda2179 add colon between asdf segment and PATH 2018-03-09 01:02:08 +11:00
James Hegedus
d3895f593c match against whole PATH segments
string replacement still doesn't match against asdf segments when last in PATH
2018-03-09 01:01:09 +11:00
James Hegedus
f8c9e97900 revert use of colons to normalize PATH
* as per suggestion from here - https://github.com/asdf-vm/asdf/pull/303#issuecomment-371231967

* need to work on new PR with tests to address newly raised edge cases with PATH manipulation
2018-03-09 00:52:08 +11:00
James Hegedus
b0342d2f78 remove unnecessary colon 2018-03-07 17:06:34 +11:00
James Hegedus
c112fbf296 use variable in all places 2018-03-06 21:53:39 +11:00
James Hegedus
99110ce8d3 add or move asdf to front of PATH 2018-03-06 21:37:44 +11:00
jthegedus
e2a98e1345 add to PATH once. Fixes #261 2018-01-14 00:42:55 +11:00
Robin Schneider
ae2c5b88a1
Properly address shellcheck warnings ignored in #156 2017-03-07 16:20:04 +01:00
Robin Schneider
809f32bb9f
export ASDF_DIR so that plugins can use it to refer to the ASDF DIR
Also fixed `shellcheck` warnings in the file.
2017-02-12 20:21:24 +01:00
Daniel Perez
1589a03678 Merge pull request #53 from ctreatma/feature/only_pwd
Fix #52: Send any `cd` output to /dev/null
2016-07-02 13:56:41 +09:00
Charles Treatman
1d11a73600 Redirect all output to /dev/null, not just stdout 2016-07-01 19:40:05 -04:00
David Bernheisel
29807fd154 zsh: remove _asdf completion. #68 2016-06-29 16:06:33 -04:00
Teja Sophista V.R
a2844400f4 use bashcompinit instead of compinit for ZSH 2016-06-27 11:14:12 +07:00
Charles Treatman
5e9b1cca77 Fix #52: Send any cd output to /dev/null
Users of `zsh` can define hook functions that execute when
the current directory changes.  If a user has their `zsh`
configured with a hook function that writes to stdout, the
`asdf` setup script will capture that output in addition to
the output of `pwd`, which causes a misconfiguration of the
`PATH` environment variable.

By redirecting the output, if any, of the `cd` command to
`/dev/null`, this ensures that the path to `bin` in `asdf`
is captured correctly regardless of `zsh` configuration.
2016-05-10 15:04:18 -04:00
Justin
7476c02f0a Adds (very) basic zsh autocompletion 2015-12-05 11:14:37 +01:00
Akash Manohar J
32c5c1a858 Check if source or dot operator is used 2015-06-17 06:14:27 +05:30
Akash Manohar J
237a5ab59e Fix #1: Better to stick to a single common shell
Referred a couple other version managers. The advantage is not having to
maintain the scripts for other shells (bash comes by default everywhere
I've seen).
2015-05-19 10:44:10 +05:30
Akash Manohar J
e80ec0cfbf Fix sourced usage 2015-05-14 12:21:01 +05:30
Akash Manohar J
f15a761c4a init script 2015-05-10 22:18:03 +05:30
Akash Manohar J
0ff759a9be Dir structure 2014-09-30 05:23:59 +05:30
Akash Manohar J
da8b5840be Stubbed out functions 2014-09-29 22:21:09 +05:30