# We shouldn't rely on the user's grep settings to be correct. If we set these # here anytime asdf invokes grep it will be invoked with these options # shellcheck disable=SC2034 global GREP_OPTIONS := '"--color=never'" # shellcheck disable=SC2034 global GREP_COLORS := '' proc asdf_version { cat "$[asdf_dir]/VERSION" } proc asdf_dir { if test -z $ASDF_DIR { var current_script_path = $(BASH_SOURCE[0]) export ASDF_DIR global ASDF_DIR := $[cd $[dirname $[dirname $current_script_path]] || exit; pwd] } echo $ASDF_DIR } proc asdf_repository_url { echo "https://github.com/asdf-vm/asdf-plugins.git" } proc get_install_path { var plugin = $1 var install_type = $2 var version = $3 mkdir -p "$[asdf_dir]/installs/$(plugin)" if test $install_type = "version" { echo "$[asdf_dir]/installs/$(plugin)/$(version)" } else { echo "$[asdf_dir]/installs/$(plugin)/$(install_type)-$(version)" } } proc list_installed_versions { var plugin_name = $1 var plugin_path = '' plugin_path := $[get_plugin_path $plugin_name] var plugin_installs_path = '' plugin_installs_path := "$[asdf_dir]/installs/$(plugin_name)" if test -d $plugin_installs_path { # shellcheck disable=SC2045 for install in [$[ls -d "$(plugin_installs_path)"/*/ !2 >/dev/null]] { basename $install } } } proc check_if_plugin_exists { # Check if we have a non-empty argument if test -z $(1) { display_error "No plugin given" exit 1 } if test ! -d "$[asdf_dir]/plugins/$1" { display_error "No such plugin" exit 1 } } proc check_if_version_exists { var plugin_name = $1 var version = $2 check_if_plugin_exists $plugin_name var install_path = '' install_path := $[find_install_path $plugin_name $version] if test $version != "system" && test ! -d $install_path { display_error "version $version is not installed for $plugin_name" exit 1 } } proc get_plugin_path { echo "$[asdf_dir]/plugins/$1" } proc display_error { echo >&2 $1> !2 "$1" } proc get_version_in_dir { var plugin_name = $1 var search_path = $2 var legacy_filenames = $3 var asdf_version = '' asdf_version := $[parse_asdf_version_file "$search_path/.tool-versions" $plugin_name] if test -n $asdf_version { echo "$asdf_version|$search_path/.tool-versions" return 0 } for filename in [$legacy_filenames] { var legacy_version = '' legacy_version := $[parse_legacy_version_file "$search_path/$filename" $plugin_name] if test -n $legacy_version { echo "$legacy_version|$search_path/$filename" return 0 } } } proc find_version { var plugin_name = $1 var search_path = $2 var version = '' version := $[get_version_from_env $plugin_name] if test -n $version { echo $version return 0 } var plugin_path = '' plugin_path := $[get_plugin_path $plugin_name] var legacy_config = '' legacy_config := $[get_asdf_config_value "legacy_version_file] var legacy_list_filenames_script = '' legacy_list_filenames_script := ""$(plugin_path)/bin/list-legacy-filenames"" var legacy_filenames = ''"" if test $legacy_config = "yes" && test -f $legacy_list_filenames_script { legacy_filenames := $[bash $legacy_list_filenames_script] } while [ "$search_path" != "/" ] { version := $[get_version_in_dir $plugin_name $search_path $legacy_filenames] if test -n $version { echo $version return 0 } search_path := $[dirname $search_path] } get_version_in_dir $plugin_name $HOME $legacy_filenames } proc get_version_from_env { var plugin_name = $1 var upcase_name = '' upcase_name := $[echo $plugin_name | tr '[:lower:]' '[:upper:]] var version_env_var = ""ASDF_$(upcase_name)_VERSION"" var version = $(!version_env_var) echo $version } proc find_install_path { var plugin_name = $1 var version = $2 # shellcheck disable=SC2162 env IFS=':' read -a version_info <<< $version if test $version = "system" { echo "" } elif test $(version_info[0]) = "ref" { var install_type = $(version_info[0]) var version = $(version_info[1]) get_install_path $plugin_name $install_type $version } elif test $(version_info[0]) = "path" { # This is for people who have the local source already compiled # Like those who work on the language, etc # We'll allow specifying path:/foo/bar/project in .tool-versions # And then use the binaries there var install_type = '"path'" var version = '"path'" echo $(version_info[1]) } else { var install_type = '"version'" var version = $(version_info[0]) get_install_path $plugin_name $install_type $version } } proc get_executable_path { var plugin_name = $1 var version = $2 var executable_path = $3 check_if_version_exists $plugin_name $version if test $version = "system" { global path := $[echo $PATH | sed -e "s|$ASDF_DIR/shims||g; s|::|:|g] global cmd := $[basename $executable_path] global cmd_path := $[env PATH=$path which $cmd !2 > !1] # shellcheck disable=SC2181 if test $Status -ne 0 { return 1 } echo $cmd_path } else { var install_path = '' install_path := $[find_install_path $plugin_name $version] echo "$(install_path)"/"$(executable_path)" } } proc parse_asdf_version_file { var file_path = $1 var plugin_name = $2 if test -f $file_path { var version = '' version := $[grep "$(plugin_name) " $file_path | sed -e "s/^$(plugin_name) //] if test -n $version { echo $version return 0 } } } proc parse_legacy_version_file { var file_path = $1 var plugin_name = $2 var plugin_path = '' plugin_path := $[get_plugin_path $plugin_name] var parse_legacy_script = '' parse_legacy_script := ""$(plugin_path)/bin/parse-legacy-file"" if test -f $file_path { if test -f $parse_legacy_script { bash $parse_legacy_script $file_path } else { cat $file_path } } } proc get_preset_version_for { var plugin_name = $1 var search_path = '' search_path := $[pwd] var version_and_path = '' version_and_path := $[find_version $plugin_name $search_path] var version = '' version := $[cut -d '|' -f 1 <<< $version_and_path]; echo $version } proc get_asdf_config_value_from_file { var config_path = $1 var key = $2 if test ! -f $config_path { return 0 } var result = '' result := $[grep -E "^\s*$key\s*=" $config_path | awk -F '=' '{ gsub(/ /, "", $2); print $2 }] if test -n $result { echo $result } } proc get_asdf_config_value { var key = $1 var config_path = $(AZDF_CONFIG_FILE:-"$HOME/.asdfrc") var default_config_path = $(AZDF_CONFIG_DEFAULT_FILE:-"$(asdf_dir)/defaults") var result = '' result := $[get_asdf_config_value_from_file $config_path $key] if test -n $result { echo $result } else { get_asdf_config_value_from_file $default_config_path $key } } proc repository_needs_update { var update_file_dir = '' update_file_dir := ""$[asdf_dir]/tmp"" var update_file_name = '' update_file_name := '"repo-updated'" # `find` outputs filename if it has not been modified in the last day var find_result = '' find_result := $[find $update_file_dir -name $update_file_name -type f -mtime +1 -print] test -n $find_result } proc initialize_or_update_repository { var repository_url = '' var repository_path = '' repository_url := $[asdf_repository_url] repository_path := "$[asdf_dir]/repository" if test ! -d $repository_path { echo "initializing plugin repository..." git clone $repository_url $repository_path } elif repository_needs_update { echo "updating plugin repository..." shell {cd $repository_path && git fetch && git reset --hard origin/master} } mkdir -p "$[asdf_dir]/tmp" touch "$[asdf_dir]/tmp/repo-updated" } proc get_plugin_source_url { var plugin_name = $1 var plugin_config = '' plugin_config := ""$[asdf_dir]/repository/plugins/$plugin_name"" if test -f $plugin_config { grep "repository" $plugin_config | awk -F'=' '{print $2}' | sed 's/ //' } } (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GREP_OPTIONS) op: Equal rhs: {(DQ ("--color=never"))} spids: [9] ) ] spids: [9] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GREP_COLORS) op:Equal rhs:{(SQ )} spids:[17])] spids: [17] ) (FuncDef name: asdf_version body: (BraceGroup children: [ (C {(cat)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [30 32] ) (/VERSION) ) } ) ] spids: [24] ) spids: [20 23] ) (FuncDef name: asdf_dir body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-z)} {(DQ ($ VSub_Name "$ASDF_DIR"))} {(Lit_Other "]")}) terminator: ) ] action: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:current_script_path) op: Equal rhs: { (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [65 70] ) } spids: [64] ) ] spids: [62] ) (C {(export)} {(ASDF_DIR)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ASDF_DIR) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Sentence child: (AndOr children: [ (C {(cd)} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(dirname)} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(dirname)} { (DQ ($ VSub_Name "$current_script_path" ) ) } ) ] ) left_token: spids: [87 93] ) ) } ) ] ) left_token: spids: [83 95] ) ) } ) (C {(exit)}) ] op_id: Op_DPipe ) terminator: ) (C {(pwd)}) ] ) left_token: spids: [79 104] ) } spids: [78] ) ] spids: [78] ) ] spids: [-1 59] ) ] spids: [-1 107] ) (C {(echo)} {(DQ ($ VSub_Name "$ASDF_DIR"))}) ] spids: [43] ) spids: [39 42] ) (FuncDef name: asdf_repository_url body: (BraceGroup children: [(C {(echo)} {(DQ ("https://github.com/asdf-vm/asdf-plugins.git"))})] spids: [124] ) spids: [120 123] ) (FuncDef name: get_install_path body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin) op: Equal rhs: {($ VSub_Number "$1")} spids: [145] ) ] spids: [143] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:install_type) op: Equal rhs: {($ VSub_Number "$2")} spids: [151] ) ] spids: [149] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: {($ VSub_Number "$3")} spids: [157] ) ] spids: [155] ) (C {(mkdir)} {(-p)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [166 168] ) (/installs/) (${ VSub_Name plugin) ) } ) (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$install_type"))} {(Lit_Other "=")} {(DQ (version))} {(Lit_Other "]")} ) ] action: [ (C {(echo)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [200 202] ) (/installs/) (${ VSub_Name plugin) (/) (${ VSub_Name version) ) } ) ] spids: [-1 194] ) ] else_action: [ (C {(echo)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [220 222] ) (/installs/) (${ VSub_Name plugin) (/) (${ VSub_Name install_type) (-) (${ VSub_Name version) ) } ) ] spids: [214 238] ) ] spids: [140] ) spids: [136 139] ) (FuncDef name: list_installed_versions body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [252] ) ] spids: [250] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:plugin_path) op:Equal spids:[258])] spids: [256] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:plugin_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(get_plugin_path)} {(DQ ($ VSub_Name "$plugin_name"))})] ) left_token: spids: [262 268] ) } spids: [261] ) ] spids: [261] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:plugin_installs_path) op:Equal spids:[274])] spids: [272] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:plugin_installs_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [278 280] ) (/installs/) (${ VSub_Name plugin_name) } spids: [277] ) ] spids: [277] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-d)} {(DQ ($ VSub_Name "$plugin_installs_path"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (ForEach iter_name: install iter_words: [ { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(ls)} {(-d)} {(DQ (${ VSub_Name plugin_installs_path)) (/) (Lit_Other "*") (/) } ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [328] ) ] ) ] ) left_token: spids: [314 330] ) } ] do_arg_iter: False body: (DoGroup children: [(C {(basename)} {(DQ ($ VSub_Name "$install"))})] spids: [333 343] ) spids: [313 331] ) ] spids: [-1 301] ) ] spids: [-1 346] ) ] spids: [247] ) spids: [243 246] ) (FuncDef name: check_if_plugin_exists body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-z)} {(DQ (${ VSub_Number 1))} {(Lit_Other "]")}) terminator: ) ] action: [(C {(display_error)} {(DQ ("No plugin given"))}) (C {(exit)} {(1)})] spids: [-1 377] ) ] spids: [-1 392] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [405 407] ) (/plugins/) ($ VSub_Number "$1") ) } {(Lit_Other "]")} ) terminator: ) ] action: [(C {(display_error)} {(DQ ("No such plugin"))}) (C {(exit)} {(1)})] spids: [-1 415] ) ] spids: [-1 430] ) ] spids: [355] ) spids: [351 354] ) (FuncDef name: check_if_version_exists body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [444] ) ] spids: [442] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: {($ VSub_Number "$2")} spids: [450] ) ] spids: [448] ) (C {(check_if_plugin_exists)} {(DQ ($ VSub_Name "$plugin_name"))}) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:install_path) op:Equal spids:[465])] spids: [463] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:install_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(find_install_path)} {(DQ ($ VSub_Name "$plugin_name"))} {(DQ ($ VSub_Name "$version"))} ) ] ) left_token: spids: [469 479] ) } spids: [468] ) ] spids: [468] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$version"))} {(KW_Bang "!") (Lit_Other "=")} {(DQ (system))} {(Lit_Other "]")} ) (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(DQ ($ VSub_Name "$install_path"))} {(Lit_Other "]")} ) ] op_id: Op_DAmp ) terminator: ) ] action: [ (C {(display_error)} { (DQ ("version ") ($ VSub_Name "$version") (" is not installed for ") ($ VSub_Name "$plugin_name") ) } ) (C {(exit)} {(1)}) ] spids: [-1 515] ) ] spids: [-1 533] ) ] spids: [439] ) spids: [435 438] ) (FuncDef name: get_plugin_path body: (BraceGroup children: [ (C {(echo)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [548 550] ) (/plugins/) ($ VSub_Number "$1") ) } ) ] spids: [542] ) spids: [538 541] ) (FuncDef name: display_error body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number "$1"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[567])] ) ] spids: [562] ) spids: [558 561] ) (FuncDef name: get_version_in_dir body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [586] ) ] spids: [584] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:search_path) op: Equal rhs: {($ VSub_Number "$2")} spids: [592] ) ] spids: [590] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:legacy_filenames) op: Equal rhs: {($ VSub_Number "$3")} spids: [598] ) ] spids: [596] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:asdf_version) op:Equal spids:[605])] spids: [603] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:asdf_version) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(parse_asdf_version_file)} {(DQ ($ VSub_Name "$search_path") (/.tool-versions))} {(DQ ($ VSub_Name "$plugin_name"))} ) ] ) left_token: spids: [609 620] ) } spids: [608] ) ] spids: [608] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} {(DQ ($ VSub_Name "$asdf_version"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(echo)} { (DQ ($ VSub_Name "$asdf_version") ("|") ($ VSub_Name "$search_path") (/.tool-versions) ) } ) (ControlFlow token: arg_word:{(0)}) ] spids: [-1 637] ) ] spids: [-1 655] ) (ForEach iter_name: filename iter_words: [{($ VSub_Name "$legacy_filenames")}] do_arg_iter: False body: (DoGroup children: [ (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:legacy_version) op:Equal spids:[673])] spids: [671] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:legacy_version) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(parse_legacy_version_file)} { (DQ ($ VSub_Name "$search_path") (/) ($ VSub_Name "$filename") ) } {(DQ ($ VSub_Name "$plugin_name"))} ) ] ) left_token: spids: [677 689] ) } spids: [676] ) ] spids: [676] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} {(DQ ($ VSub_Name "$legacy_version"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(echo)} { (DQ ($ VSub_Name "$legacy_version") ("|") ($ VSub_Name "$search_path") (/) ($ VSub_Name "$filename") ) } ) (ControlFlow token: arg_word: {(0)} ) ] spids: [-1 706] ) ] spids: [-1 725] ) ] spids: [668 728] ) spids: [664 666] ) ] spids: [581] ) spids: [577 580] ) (FuncDef name: find_version body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [742] ) ] spids: [740] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:search_path) op: Equal rhs: {($ VSub_Number "$2")} spids: [748] ) ] spids: [746] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:version) op:Equal spids:[755])] spids: [753] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(get_version_from_env)} {(DQ ($ VSub_Name "$plugin_name"))})] ) left_token: spids: [759 765] ) } spids: [758] ) ] spids: [758] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} {(DQ ($ VSub_Name "$version"))} {(Lit_Other "]")}) terminator: ) ] action: [ (C {(echo)} {(DQ ($ VSub_Name "$version"))}) (ControlFlow token: arg_word:{(0)}) ] spids: [-1 781] ) ] spids: [-1 796] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:plugin_path) op:Equal spids:[802])] spids: [800] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:plugin_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(get_plugin_path)} {(DQ ($ VSub_Name "$plugin_name"))})] ) left_token: spids: [806 812] ) } spids: [805] ) ] spids: [805] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:legacy_config) op:Equal spids:[817])] spids: [815] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:legacy_config) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(get_asdf_config_value)} {(DQ (legacy_version_file))})] ) left_token: spids: [821 827] ) } spids: [820] ) ] spids: [820] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:legacy_list_filenames_script) op: Equal spids: [832] ) ] spids: [830] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:legacy_list_filenames_script) op: Equal rhs: {(DQ (${ VSub_Name plugin_path) (/bin/list-legacy-filenames))} spids: [835] ) ] spids: [835] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:legacy_filenames) op: Equal rhs: {(DQ )} spids: [846] ) ] spids: [844] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$legacy_config"))} {(Lit_Other "=")} {(DQ (yes))} {(Lit_Other "]")} ) (C {(Lit_Other "[")} {(-f)} {(DQ ($ VSub_Name "$legacy_list_filenames_script"))} {(Lit_Other "]")} ) ] op_id: Op_DAmp ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:legacy_filenames) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(bash)} {(DQ ($ VSub_Name "$legacy_list_filenames_script"))}) ] ) left_token: spids: [885 891] ) } spids: [884] ) ] spids: [884] ) ] spids: [-1 881] ) ] spids: [-1 894] ) (While cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$search_path"))} {(KW_Bang "!") (Lit_Other "=")} {(DQ (/))} {(Lit_Other "]")} ) terminator: ) ] body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get_version_in_dir)} {(DQ ($ VSub_Name "$plugin_name"))} {(DQ ($ VSub_Name "$search_path"))} {(DQ ($ VSub_Name "$legacy_filenames"))} ) ] ) left_token: spids: [920 934] ) } spids: [919] ) ] spids: [919] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} {(DQ ($ VSub_Name "$version"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(echo)} {(DQ ($ VSub_Name "$version"))}) (ControlFlow token: arg_word: {(0)} ) ] spids: [-1 950] ) ] spids: [-1 965] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:search_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ ($ VSub_Name "$search_path"))})] ) left_token: spids: [969 975] ) } spids: [968] ) ] spids: [968] ) ] spids: [916 978] ) ) (C {(get_version_in_dir)} {(DQ ($ VSub_Name "$plugin_name"))} {(DQ ($ VSub_Name "$HOME"))} {(DQ ($ VSub_Name "$legacy_filenames"))} ) ] spids: [737] ) spids: [733 736] ) (FuncDef name: get_version_from_env body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [1009] ) ] spids: [1007] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:upcase_name) op:Equal spids:[1015])] spids: [1013] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:upcase_name) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ ($ VSub_Name "$plugin_name"))}) (C {(tr)} {(SQ <"[:lower:]">)} {(SQ <"[:upper:]">)}) ] negated: False ) ] ) left_token: spids: [1019 1037] ) } spids: [1018] ) ] spids: [1018] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:version_env_var) op: Equal rhs: {(DQ (ASDF_) (${ VSub_Name upcase_name) (_VERSION))} spids: [1042] ) ] spids: [1040] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: { (BracedVarSub token: prefix_op: VSub_Bang spids: [1055 1058] ) } spids: [1054] ) ] spids: [1052] ) (C {(echo)} {(DQ ($ VSub_Name "$version"))}) ] spids: [1004] ) spids: [999 1003] ) (FuncDef name: find_install_path body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [1079] ) ] spids: [1077] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: {($ VSub_Number "$2")} spids: [1085] ) ] spids: [1083] ) (SimpleCommand words: [{(read)} {(-a)} {(version_info)}] redirects: [ (Redir op_id: Redir_TLess fd: -1 arg_word: {(DQ ($ VSub_Name "$version"))} spids: [1105] ) ] more_env: [(env_pair name:IFS val:{(SQ <":">)} spids:[1094])] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$version"))} {(Lit_Other "=")} {(DQ (system))} {(Lit_Other "]")} ) terminator: ) ] action: [(C {(echo)} {(DQ )})] spids: [-1 1130] ) (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [1144 1149] ) ) } {(Lit_Other "=")} {(DQ (ref))} {(Lit_Other "]")} ) terminator: ) ] action: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:install_type) op: Equal rhs: { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [1168 1173] ) ) } spids: [1166] ) ] spids: [1164] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 1)})) spids: [1181 1186] ) ) } spids: [1179] ) ] spids: [1177] ) (C {(get_install_path)} {(DQ ($ VSub_Name "$plugin_name"))} {(DQ ($ VSub_Name "$install_type"))} {(DQ ($ VSub_Name "$version"))} ) ] spids: [1139 1161] ) (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [1210 1215] ) ) } {(Lit_Other "=")} {(DQ (path))} {(Lit_Other "]")} ) terminator: ) ] action: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:install_type) op: Equal rhs: {(DQ (path))} spids: [1248] ) ] spids: [1246] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: {(DQ (path))} spids: [1256] ) ] spids: [1254] ) (C {(echo)} { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 1)})) spids: [1265 1270] ) ) } ) ] spids: [1205 1227] ) ] else_action: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:install_type) op: Equal rhs: {(DQ (version))} spids: [1279] ) ] spids: [1277] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [1289 1294] ) ) } spids: [1287] ) ] spids: [1285] ) (C {(get_install_path)} {(DQ ($ VSub_Name "$plugin_name"))} {(DQ ($ VSub_Name "$install_type"))} {(DQ ($ VSub_Name "$version"))} ) ] spids: [1274 1313] ) ] spids: [1074] ) spids: [1070 1073] ) (FuncDef name: get_executable_path body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [1327] ) ] spids: [1325] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: {($ VSub_Number "$2")} spids: [1333] ) ] spids: [1331] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:executable_path) op: Equal rhs: {($ VSub_Number "$3")} spids: [1339] ) ] spids: [1337] ) (C {(check_if_version_exists)} {(DQ ($ VSub_Name "$plugin_name"))} {(DQ ($ VSub_Name "$version"))} ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$version"))} {(Lit_Other "=")} {(DQ (system))} {(Lit_Other "]")} ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ ($ VSub_Name "$PATH"))}) (C {(sed)} {(-e)} { (DQ ("s|") ($ VSub_Name "$ASDF_DIR") ("/shims||g; s|::|:|g") ) } ) ] negated: False ) ] ) left_token: spids: [1377 1395] ) } spids: [1376] ) ] spids: [1376] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(basename)} {(DQ ($ VSub_Name "$executable_path"))})] ) left_token: spids: [1399 1405] ) } spids: [1398] ) ] spids: [1398] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{(which)} {(DQ ($ VSub_Name "$cmd"))}] redirects: [ (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [1419] ) ] more_env: [ (env_pair name: PATH val: {($ VSub_Name "$path")} spids: [1410] ) ] ) ] ) left_token: spids: [1409 1421] ) } spids: [1408] ) ] spids: [1408] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_QMark "$?")} {(-ne)} {(0)} {(Lit_Other "]")}) terminator: ) ] action: [(ControlFlow token: arg_word:{(1)})] spids: [-1 1441] ) ] spids: [-1 1449] ) (C {(echo)} {(DQ ($ VSub_Name "$cmd_path"))}) ] spids: [-1 1373] ) ] else_action: [ (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:install_path) op:Equal spids:[1464])] spids: [1462] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:install_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(find_install_path)} {(DQ ($ VSub_Name "$plugin_name"))} {(DQ ($ VSub_Name "$version"))} ) ] ) left_token: spids: [1468 1478] ) } spids: [1467] ) ] spids: [1467] ) (C {(echo)} {(DQ (${ VSub_Name install_path)) (/) (DQ (${ VSub_Name executable_path))}) ] spids: [1459 1496] ) ] spids: [1322] ) spids: [1318 1321] ) (FuncDef name: parse_asdf_version_file body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:file_path) op: Equal rhs: {($ VSub_Number "$1")} spids: [1510] ) ] spids: [1508] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$2")} spids: [1516] ) ] spids: [1514] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {(DQ ($ VSub_Name "$file_path"))} {(Lit_Other "]")}) terminator: ) ] action: [ (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:version) op:Equal spids:[1539])] spids: [1537] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(DQ (${ VSub_Name plugin_name) (" "))} {(DQ ($ VSub_Name "$file_path"))} ) (C {(sed)} {(-e)} {(DQ ("s/^") (${ VSub_Name plugin_name) (" //"))} ) ] negated: False ) ] ) left_token: spids: [1543 1570] ) } spids: [1542] ) ] spids: [1542] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} {(DQ ($ VSub_Name "$version"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(echo)} {(DQ ($ VSub_Name "$version"))}) (ControlFlow token: arg_word: {(0)} ) ] spids: [-1 1586] ) ] spids: [-1 1601] ) ] spids: [-1 1534] ) ] spids: [-1 1604] ) ] spids: [1505] ) spids: [1501 1504] ) (FuncDef name: parse_legacy_version_file body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:file_path) op: Equal rhs: {($ VSub_Number "$1")} spids: [1618] ) ] spids: [1616] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$2")} spids: [1624] ) ] spids: [1622] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:plugin_path) op:Equal spids:[1631])] spids: [1629] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:plugin_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(get_plugin_path)} {(DQ ($ VSub_Name "$plugin_name"))})] ) left_token: spids: [1635 1641] ) } spids: [1634] ) ] spids: [1634] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:parse_legacy_script) op:Equal spids:[1646])] spids: [1644] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:parse_legacy_script) op: Equal rhs: {(DQ (${ VSub_Name plugin_path) (/bin/parse-legacy-file))} spids: [1649] ) ] spids: [1649] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {(DQ ($ VSub_Name "$file_path"))} {(Lit_Other "]")}) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {(DQ ($ VSub_Name "$parse_legacy_script"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(bash)} {(DQ ($ VSub_Name "$parse_legacy_script"))} {(DQ ($ VSub_Name "$file_path"))} ) ] spids: [-1 1688] ) ] else_action: [(C {(cat)} {(DQ ($ VSub_Name "$file_path"))})] spids: [1702 1712] ) ] spids: [-1 1672] ) ] spids: [-1 1715] ) ] spids: [1613] ) spids: [1609 1612] ) (FuncDef name: get_preset_version_for body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [1729] ) ] spids: [1727] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:search_path) op:Equal spids:[1735])] spids: [1733] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:search_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: spids: [1739 1741] ) } spids: [1738] ) ] spids: [1738] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:version_and_path) op:Equal spids:[1746])] spids: [1744] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:version_and_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(find_version)} {(DQ ($ VSub_Name "$plugin_name"))} {(DQ ($ VSub_Name "$search_path"))} ) ] ) left_token: spids: [1750 1760] ) } spids: [1749] ) ] spids: [1749] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:version) op:Equal spids:[1765])] spids: [1763] ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{(cut)} {(-d)} {(SQ <"|">)} {(-f)} {(1)}] redirects: [ (Redir op_id: Redir_TLess fd: -1 arg_word: {(DQ ($ VSub_Name "$version_and_path"))} spids: [1782] ) ] ) ] ) left_token: spids: [1769 1787] ) } spids: [1768] ) ] spids: [1768] ) terminator: ) (C {(echo)} {(DQ ($ VSub_Name "$version"))}) ] spids: [1724] ) spids: [1720 1723] ) (FuncDef name: get_asdf_config_value_from_file body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:config_path) op: Equal rhs: {($ VSub_Number "$1")} spids: [1810] ) ] spids: [1808] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:key) op: Equal rhs: {($ VSub_Number "$2")} spids: [1816] ) ] spids: [1814] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-f)} {(DQ ($ VSub_Name "$config_path"))} {(Lit_Other "]")} ) terminator: ) ] action: [(ControlFlow token: arg_word:{(0)})] spids: [-1 1836] ) ] spids: [-1 1844] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:result) op:Equal spids:[1850])] spids: [1848] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:result) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(-E)} { (DQ ("^") (EscapedLiteralPart token:) ("*") ($ VSub_Name "$key") (EscapedLiteralPart token:) ("*=") ) } {(DQ ($ VSub_Name "$config_path"))} ) (C {(awk)} {(-F)} {(SQ <"=">)} {(SQ <"{ gsub(/ /, \"\", $2); print $2 }">)} ) ] negated: False ) ] ) left_token: spids: [1854 1885] ) } spids: [1853] ) ] spids: [1853] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} {(DQ ($ VSub_Name "$result"))} {(Lit_Other "]")}) terminator: ) ] action: [(C {(echo)} {(DQ ($ VSub_Name "$result"))})] spids: [-1 1901] ) ] spids: [-1 1911] ) ] spids: [1805] ) spids: [1801 1804] ) (FuncDef name: get_asdf_config_value body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:key) op: Equal rhs: {($ VSub_Number "$1")} spids: [1925] ) ] spids: [1923] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:config_path) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(DQ ($ VSub_Name "$HOME") (/.asdfrc))} ) spids: [1932 1939] ) } spids: [1931] ) ] spids: [1929] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:default_config_path) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [1949 1951] ) (/defaults) ) } ) spids: [1945 1954] ) } spids: [1944] ) ] spids: [1942] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:result) op:Equal spids:[1960])] spids: [1958] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:result) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(get_asdf_config_value_from_file)} {(DQ ($ VSub_Name "$config_path"))} {(DQ ($ VSub_Name "$key"))} ) ] ) left_token: spids: [1964 1974] ) } spids: [1963] ) ] spids: [1963] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} {(DQ ($ VSub_Name "$result"))} {(Lit_Other "]")}) terminator: ) ] action: [(C {(echo)} {(DQ ($ VSub_Name "$result"))})] spids: [-1 1991] ) ] else_action: [ (C {(get_asdf_config_value_from_file)} {(DQ ($ VSub_Name "$default_config_path"))} {(DQ ($ VSub_Name "$key"))} ) ] spids: [2001 2015] ) ] spids: [1920] ) spids: [1916 1919] ) (FuncDef name: repository_needs_update body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:update_file_dir) op:Equal spids:[2029])] spids: [2027] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:update_file_dir) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [2034 2036] ) (/tmp) ) } spids: [2032] ) ] spids: [2032] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:update_file_name) op:Equal spids:[2043])] spids: [2041] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:update_file_name) op: Equal rhs: {(DQ (repo-updated))} spids: [2046] ) ] spids: [2046] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:find_result) op:Equal spids:[2058])] spids: [2056] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:find_result) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(find)} {(DQ ($ VSub_Name "$update_file_dir"))} {(-name)} {(DQ ($ VSub_Name "$update_file_name"))} {(-type)} {(f)} {(-mtime)} {(Lit_Other "+") (1)} {(-print)} ) ] ) left_token: spids: [2062 2085] ) } spids: [2061] ) ] spids: [2061] ) (C {(Lit_Other "[")} {(-n)} {(DQ ($ VSub_Name "$find_result"))} {(Lit_Other "]")}) ] spids: [2024] ) spids: [2020 2023] ) (FuncDef name: initialize_or_update_repository body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:repository_url) op:Equal spids:[2110])] spids: [2108] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:repository_path) op:Equal spids:[2115])] spids: [2113] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:repository_url) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(asdf_repository_url)})]) left_token: spids: [2120 2122] ) } spids: [2119] ) ] spids: [2119] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:repository_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [2126 2128] ) (/repository) } spids: [2125] ) ] spids: [2125] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(DQ ($ VSub_Name "$repository_path"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(echo)} {(DQ ("initializing plugin repository..."))}) (C {(git)} {(clone)} {(DQ ($ VSub_Name "$repository_url"))} {(DQ ($ VSub_Name "$repository_path"))} ) ] spids: [-1 2148] ) (if_arm cond: [(Sentence child:(C {(repository_needs_update)}) terminator:)] action: [ (C {(echo)} {(DQ ("updating plugin repository..."))}) (Subshell child: (AndOr children: [ (C {(cd)} {(DQ ($ VSub_Name "$repository_path"))}) (AndOr children: [ (C {(git)} {(fetch)}) (C {(git)} {(reset)} {(--hard)} {(origin/master)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) spids: [2186 2208] ) ] spids: [2171 2176] ) ] spids: [-1 2211] ) (C {(mkdir)} {(-p)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [2220 2222] ) (/tmp) ) } ) (C {(touch)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [2230 2232] ) (/tmp/repo-updated) ) } ) ] spids: [2105] ) spids: [2101 2104] ) (FuncDef name: get_plugin_source_url body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [2248] ) ] spids: [2246] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:plugin_config) op:Equal spids:[2254])] spids: [2252] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:plugin_config) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(asdf_dir)})]) left_token: spids: [2260 2262] ) (/repository/plugins/) ($ VSub_Name "$plugin_name") ) } spids: [2258] ) ] spids: [2258] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {(DQ ($ VSub_Name "$plugin_config"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (Pipeline children: [ (C {(grep)} {(DQ (repository))} {(DQ ($ VSub_Name "$plugin_config"))}) (C {(awk)} {(-F) (SQ <"=">)} {(SQ <"{print $2}">)}) (C {(sed)} {(SQ <"s/ //">)}) ] negated: False ) ] spids: [-1 2283] ) ] spids: [-1 2318] ) ] spids: [2243] ) spids: [2239 2242] ) ] )