mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
9afd7cf3bf
* Implement plugins control of nnn + plugins * Refactor plugins control code and fix getplugs to recognize hidden files * Fix bug when going to dir on non-current context from plugin * Fix some plugins to work on openbsd and freebsd * Renamings * Switch to -R flag in cp instead of -r; BSDs complain * Change braces of function location * Rewrite plugin creation in README and add new plugins to the table * Update the fzcd script to include fzy or fzf * Change plugin name resolve-link-dir -> lncd * Fixing plugins README table * Remove some cd plugins but add them as examples to plugins README
35 lines
814 B
Bash
Executable file
35 lines
814 B
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
# Description: Update nnn plugins
|
|
#
|
|
# Shell: POSIX compliant
|
|
# Author: Arun Prakash Jana
|
|
|
|
CONFIG_DIR=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/
|
|
PLUGIN_DIR=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins
|
|
|
|
is_cmd_exists () {
|
|
which "$1" > /dev/null 2>&1
|
|
echo $?
|
|
}
|
|
|
|
if [ "$(is_cmd_exists sudo)" == "0" ]; then
|
|
sucmd=sudo
|
|
elif [ "$(is_cmd_exists doas)" == "0" ]; then
|
|
sucmd=doas
|
|
else
|
|
sucmd=: # noop
|
|
fi
|
|
|
|
# backup any earlier plugins
|
|
if [ -d $PLUGIN_DIR ]; then
|
|
tar -C $CONFIG_DIR -czf $CONFIG_DIR"plugins-$(date '+%Y%m%d%H%M').tar.gz" plugins/
|
|
fi
|
|
|
|
cd $CONFIG_DIR
|
|
curl -Ls -O https://github.com/jarun/nnn/archive/master.tar.gz
|
|
tar -zxf master.tar.gz
|
|
cp -vRf nnn-master/plugins .
|
|
$sucmd mv -vf nnn-master/misc/nlaunch/nlaunch /usr/local/bin/
|
|
rm -rf nnn-master/ master.tar.gz README.md
|