Cleanup readme

This commit is contained in:
Akash Manohar J 2014-11-30 15:48:49 +05:30
parent a4ec3cd902
commit cdee09dec3
2 changed files with 44 additions and 13 deletions

View File

@ -15,7 +15,8 @@ asdf source-remove <package>
asdf source-update
asdf source-update <package>
## `.asdf-versions` file
## `.versions` file
```
elixir 1.0.0
@ -25,10 +26,12 @@ erlang 17.3
## Package source structure
A package source is a git repo, with the following files
A package source is a git repo, with the following executable scripts
* `bin/install`
* `bin/uninstall`
* `bin/use`
* `bin/list-all` - lists all installable versions
* `bin/install` - installs the specified version
* `bin/uninstall` - uninstalls the specified version
* `bin/use` - uses the specified version (and also adds the version to `.versions` file in the dir)
These scripts are run when `package install`, `package uninstall` or `package use` commands are run. You can set or unset env vars,
These scripts are run when `list-all`, `install`, `uninstall` or `use` commands are run. You can set or unset env vars,

View File

@ -1,10 +1,11 @@
run_command() {
local callback_args="${@:2}"
run_callback_if_command "--version" $1 asdf_version $callback_args
run_callback_if_command "install" $1 install_command $callback_args
run_callback_if_command "list" $1 list_command $callback_args
run_callback_if_command "list-all" $1 list_all_command $callback_args
run_callback_if_command "help" $1 help_command $callback_args
run_callback_if_command "--version" $1 asdf_version $callback_args
run_callback_if_command "install" $1 install_command $callback_args
run_callback_if_command "uninstall" $1 uninstall_command $callback_args
run_callback_if_command "list" $1 list_command $callback_args
run_callback_if_command "list-all" $1 list_all_command $callback_args
run_callback_if_command "help" $1 help_command $callback_args
help_command
@ -30,7 +31,34 @@ install_command() {
fi
local install_path=$(get_install_path $package $full_version)
${source_path}/install $install_type $version $install_path "${@:3}"
${source_path}/bin/install $install_type $version $install_path "${@:3}"
}
uninstall_command() {
local package=$1
local full_version=$2
local source_path=$(get_source_path $package)
check_if_source_exists $source_path
if [ ! -d "$source_path/$full_version" ]
then
display_error "No such version"
exit 1
fi
IFS=':' read -a version_info <<< "$full_version"
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]
then
local install_type="${version_info[0]}"
local version="${version_info[1]}"
else
local install_type="version"
local version="${version_info[0]}"
fi
local install_path=$(get_install_path $package $full_version)
${source_path}/bin/uninstall $install_type $version $install_path "${@:3}"
}
@ -46,7 +74,7 @@ get_install_path() {
list_all_command() {
local source_path=$(get_source_path $1)
check_if_source_exists $source_path
${source_path}/list-all
${source_path}/bin/list-all
}