Link to functions called by a wrapper

Hi,

It would be great if there was a way to manage functions wrappers and ensure that the functions names passed as arguments have an hyperlink to the function definition.

#!/bin/bash

run_verbose() {
  local command=$1
  echo "> Function $command called ..."
  $command
}

bash_support_pro_is_awesome() {
  echo "Bash Support Pro is awesome !"
}

run_verbose bash_support_pro_is_awesome

The objective is to have an hyperlink onbash_support_pro_is_awesome on the line run_verbose bash_support_pro_is_awesome

I guess a special comment could be added to the local command=$1 line to define that the argument is a function name.

Something similar was requested by others and I’ve been thinking about this for while.

Placing the parameter meta-information into the function comments seems best to me. But AFAIK there’s no existing “standard” for this and so far I didn’t want to invent something new, which would be only used for BashSupport Pro.
But adding this would help with code completion of run_verbose <here> and would also allow to rename the argument to run_verbose when bash_support_pro_is_awesome is renamed.

What do you think?

#!/bin/bash

# @param type=function "Name of the function to execute"
# @params "Arguments passed to the executed function"
run_verbose() {
  local command=$1
  shift
  echo "> Function $command called ..."
  $command "$@"
}

bash_support_pro_is_awesome() {
  echo "Bash Support Pro is awesome !"
}

run_verbose bash_support_pro_is_awesome

Yeah indeed, the refactoring support is also a very nice feature.

I like the way to describe functions parameters, it looks like what we used to use in many other languages.

:+1: