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

Adding show-toolchain for command line prompts. #148

Merged
merged 1 commit into from
Apr 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/multirust
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# update Install or update a given toolchain (for example, "stable", "beta", "nightly")
# show-override Show information about the current override
# show-default Show information about the current default
# show-toolchain Show the name of the current toolcain
# list-overrides List all overrides
# list-toolchains List all installed toolchains
# remove-override Remove an override, for current directory unless specified
Expand Down Expand Up @@ -160,6 +161,14 @@
#
# </help-show-override>

# <help-show-toolchain>
#
# Displays the name of the toolchain that would be used.
#
# Usage: multirust show-toolchain
#
# </help-show-toolchain>

# <help-list-overrides>
#
# Displays a list of all overrides.
Expand Down Expand Up @@ -463,6 +472,7 @@ handle_command_line_args() {
override
show-default
show-override
show-toolchain
list-overrides
list-toolchains
remove-override
Expand Down Expand Up @@ -546,6 +556,7 @@ handle_command_line_args() {

show-default) show_default;;
show-override) show_override;;
show-toolchain) show_toolchain;;
list-overrides) list_overrides;;
list-toolchains) list_toolchains;;
remove-override)
Expand Down Expand Up @@ -1341,6 +1352,18 @@ show_override() {
fi
}

show_toolchain() {
local _toolchain=
if find_override; then
_toolchain="$RETVAL_TOOLCHAIN"
elif find_default; then
_toolchain="$RETVAL_TOOLCHAIN"
else
_toolchain="No default"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should it print something if it can't find a default, or should it print nothing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For comparison, rbenv local prints nothing to STDOUT, but it does print an error to STDERR if it cannot determine the local version of ruby that should apply.

Copy link
Owner

Choose a reason for hiding this comment

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

Let's print nothing then to match rbenv.

fi
echo "$_toolchain"
}

show_tool_versions() {
local _toolchain="$1"

Expand Down