proc plugin_current_command { var plugin_name = $1 check_if_plugin_exists $plugin_name 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]; var version_file_path = '' version_file_path := $[cut -d '|' -f 2 <<< $version_and_path]; check_if_version_exists $plugin_name $version check_for_deprecated_plugin $plugin_name if test -z $version { echo "No version set for $plugin_name" exit 1 } else { echo "$version (set by $version_file_path)" } } proc current_command { if test $Argc -eq 0 { for plugin in [$[plugin_list_command]] { echo "$plugin $[plugin_current_command $plugin]" } } else { var plugin = $1 plugin_current_command $plugin } } # Warn if the plugin isn't using the updated legacy file api. proc check_for_deprecated_plugin { var plugin_name = $1 var plugin_path = '' plugin_path := $[get_plugin_path $plugin_name] var legacy_config = '' legacy_config := $[get_asdf_config_value "legacy_version_file] var deprecated_script = ""$(plugin_path)/bin/get-version-from-legacy-file"" var new_script = ""$(plugin_path)/bin/list-legacy-filenames"" if test $legacy_config = "yes" && test -f $deprecated_script && test ! -f $new_script { echo "Heads up! It looks like your $plugin_name plugin is out of date. You can update it with:" echo "" echo " asdf plugin-update $plugin_name" echo "" } } (CommandList children: [ (FuncDef name: plugin_current_command body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [9] ) ] spids: [7] ) (C {(check_if_plugin_exists)} {(DQ ($ VSub_Name "$plugin_name"))}) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:search_path) op:Equal spids:[24])] spids: [22] ) (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: [28 30] ) } spids: [27] ) ] spids: [27] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:version_and_path) op:Equal spids:[35])] spids: [33] ) (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: [39 49] ) } spids: [38] ) ] spids: [38] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:version) op:Equal spids:[54])] spids: [52] ) (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: [71] ) ] ) ] ) left_token: spids: [58 76] ) } spids: [57] ) ] spids: [57] ) terminator: ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:version_file_path) op:Equal spids:[82])] spids: [80] ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:version_file_path) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{(cut)} {(-d)} {(SQ <"|">)} {(-f)} {(2)}] redirects: [ (Redir op_id: Redir_TLess fd: -1 arg_word: {(DQ ($ VSub_Name "$version_and_path"))} spids: [99] ) ] ) ] ) left_token: spids: [86 104] ) } spids: [85] ) ] spids: [85] ) terminator: ) (C {(check_if_version_exists)} {(DQ ($ VSub_Name "$plugin_name"))} {(DQ ($ VSub_Name "$version"))} ) (C {(check_for_deprecated_plugin)} {(DQ ($ VSub_Name "$plugin_name"))}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-z)} {(DQ ($ VSub_Name "$version"))} {(Lit_Other "]")}) terminator: ) ] action: [ (C {(echo)} {(DQ ("No version set for ") ($ VSub_Name "$plugin_name"))}) (C {(exit)} {(1)}) ] spids: [-1 141] ) ] else_action: [ (C {(echo)} { (DQ ($ VSub_Name "$version") (" (set by ") ($ VSub_Name "$version_file_path") (")")) } ) ] spids: [157 170] ) ] spids: [4] ) spids: [0 3] ) (FuncDef name: current_command body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Pound "$#")} {(-eq)} {(0)} {(Lit_Other "]")}) terminator: ) ] action: [ (ForEach iter_name: plugin iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(plugin_list_command)})]) left_token: spids: [204 206] ) } ] do_arg_iter: False body: (DoGroup children: [ (C {(echo)} { (DQ ($ VSub_Name "$plugin") (" ") (CommandSubPart command_list: (CommandList children: [ (C {(plugin_current_command)} {(DQ ($ VSub_Name "$plugin"))}) ] ) left_token: spids: [217 223] ) ) } ) ] spids: [209 227] ) spids: [203 207] ) ] spids: [-1 195] ) ] else_action: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin) op: Equal rhs: {($ VSub_Number "$1")} spids: [235] ) ] spids: [233] ) (C {(plugin_current_command)} {(DQ ($ VSub_Name "$plugin"))}) ] spids: [230 246] ) ] spids: [179] ) spids: [175 178] ) (FuncDef name: check_for_deprecated_plugin body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:plugin_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [263] ) ] spids: [261] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:plugin_path) op:Equal spids:[270])] spids: [268] ) (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: [274 280] ) } spids: [273] ) ] spids: [273] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:legacy_config) op:Equal spids:[285])] spids: [283] ) (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: [289 295] ) } spids: [288] ) ] spids: [288] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:deprecated_script) op: Equal rhs: {(DQ (${ VSub_Name plugin_path) (/bin/get-version-from-legacy-file))} spids: [300] ) ] spids: [298] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:new_script) op: Equal rhs: {(DQ (${ VSub_Name plugin_path) (/bin/list-legacy-filenames))} spids: [311] ) ] spids: [309] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$legacy_config"))} {(Lit_Other "=")} {(DQ (yes))} {(Lit_Other "]")} ) (AndOr children: [ (C {(Lit_Other "[")} {(-f)} {(DQ ($ VSub_Name "$deprecated_script"))} {(Lit_Other "]")} ) (C {(Lit_Other "[")} {(KW_Bang "!")} {(-f)} {(DQ ($ VSub_Name "$new_script"))} {(Lit_Other "]")} ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) terminator: ) ] action: [ (C {(echo)} { (DQ ("Heads up! It looks like your ") ($ VSub_Name "$plugin_name") (" plugin is out of date. You can update it with:") ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ (" asdf plugin-update ") ($ VSub_Name "$plugin_name"))}) (C {(echo)} {(DQ )}) ] spids: [-1 364] ) ] spids: [-1 396] ) ] spids: [258] ) spids: [254 257] ) ] )