tmux-plugins / tpm

Tmux Plugin Manager
MIT License
11.95k stars 420 forks source link

Document dependency on awk #161

Open betaprior opened 4 years ago

betaprior commented 4 years ago

For some reason awk wasn't installed on a machine, and I spent a while trying to figure out why tpm wasn't doing anything.

maffblaster commented 4 years ago

Yes, tpm depends on the system running an awk implementation to parse plugins. It is referenced in the following functions, which are both present in the scripts/helpers/plugin_functions.sh file:

# return files sourced from tmux config files
_sourced_files() {
        _tmux_conf_contents |
                awk '/^[ \t]*source(-file)? +/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $2 }'
}
tpm_plugins_list_helper() {
        # lists plugins from @tpm_plugins option
        echo "$(tmux start-server\; show-option -gqv "$tpm_plugins_variable_name")"

        # read set -g @plugin "tmux-plugins/tmux-example-plugin" entries
        _tmux_conf_contents "full" |
                awk '/^[ \t]*set(-option)? +-g +@plugin/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $4 }'
}

Since awk is not part of bash, it - as well as possibly the coreutils binaries (echo, cat, etc.) - should be listed as a hard dependency.

Perhaps someone could work some magic and write a regex parser in bash. :smiley: