Skip to content
Snippets Groups Projects
Unverified Commit 2f5c7ddb authored by Michael Aaron Murphy's avatar Michael Aaron Murphy Committed by GitHub
Browse files

Merge pull request #618 from dlrobertson/master

Improve bad argument parsing of setup.ion
parents 615818e0 b38d845d
No related branches found
No related tags found
No related merge requests found
...@@ -20,22 +20,31 @@ fn print_option definition description ...@@ -20,22 +20,31 @@ fn print_option definition description
echo " ${c::bold}- ${c::0x0CF}$definition: ${c::reset}$description" echo " ${c::bold}- ${c::0x0CF}$definition: ${c::reset}$description"
end end
# In case a bad argument was supplied, this will be used. # Print all available options
fn bad_arg argument fn show_options
echo -e "${c::0xF60,bold}Error: ${c::0xF06}`$argument`${c::0xF60} is \ echo -e "${c::0x0F6}Available options for this script are:${c::reset}"
not a valid command.${c::reset}\n${c::0x0F6}Available options for \
this script are:${c::reset}"
print_option "build ion" " Build the Ion shell" print_option "build ion" " Build the Ion shell"
print_option "build docs" " Build the Ion mdBook" print_option "build docs" " Build the Ion mdBook"
print_option "install ion" " Install the Ion Shell" print_option "install ion" " Install the Ion Shell"
print_option "install docs" " Install the Ion mdBook" print_option "install docs" " Install the Ion mdBook"
print_option "install plugins" "Install official Ion plugins" print_option "install plugins" "Install official Ion plugins"
print_option "uninstall ion" " Removes Ion from System" print_option "uninstall ion" " Removes Ion from System"
end
# In case a bad argument was supplied, this will be used.
fn bad_arg argument
echo -e "${c::0xF60,bold}Error: ${c::0xF06}`$argument`${c::0xF60} is \
not a valid command.${c::reset}"
show_options
exit exit
end end
# Arguments are required! # Arguments are required!
if test 1 -eq $len(@args); bad_arg; end if test 1 -eq $len(@args)
echo -e "${c::0xF60,bold}Error: must proved command.${c::reset}"
show_options
exit
end
# Rust/Cargo is required! # Rust/Cargo is required!
if not exists -b "cargo" if not exists -b "cargo"
...@@ -77,4 +86,4 @@ match "@args[1..3]" ...@@ -77,4 +86,4 @@ match "@args[1..3]"
sudo rm ${SHAREDIR} -R sudo rm ${SHAREDIR} -R
case _ case _
bad_arg "@args[1..3]" bad_arg "@args[1..3]"
end end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment