From aed1ce476d3ee6d718302b6a418c17f3c5f78a50 Mon Sep 17 00:00:00 2001 From: Jorge Morante Date: Tue, 15 Aug 2023 14:01:38 +0200 Subject: [PATCH] install wizard WIP --- install-wizard.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++++ tmux-fingers.tmux | 12 +++++++----- 2 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 install-wizard.sh diff --git a/install-wizard.sh b/install-wizard.sh new file mode 100644 index 0000000..4bf0491 --- /dev/null +++ b/install-wizard.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PLATFORM=$(uname -s) + +if [[ "$1" == "download-binary" ]]; then + echo "Downloading binary..." + exit 0 +fi + +if [[ "$1" == "install-with-brew" ]]; then + echo "Installing with brew..." + exit 0 +fi + +if [[ "$1" == "install-fromsource" ]]; then + echo "Install from source..." + exit 0 +fi + +function binary_or_brew_label() { + if [[ "$PLATFORM" == "Darwin" ]]; then + echo "Install from source" + else + echo "Download binary" + fi +} + +function binary_or_brew_action() { + if [[ "$PLATFORM" == "Darwin" ]]; then + echo "download-binary" + else + echo "install-with-brew" + fi +} + +tmux display-menu -T "tmux-fingers" \ + "" \ + "- " "" ""\ + "- #[nodim,bold]Welcome to tmux-fingers! ✌️ " "" ""\ + "- " "" ""\ + "- It looks like it is the first time you are running the plugin. We need the binary first for things to work. " "" "" \ + "- " "" ""\ + "" \ + "$(binary_or_brew_label)" b "display-popup 'bash $CURRENT_DIR/$0 $(binary_or_brew_label)" \ + "Build from source" s "display-popup 'bash $CURRENT_DIR/$0 install-from-source'" \ + "" \ + "Exit" q "" diff --git a/tmux-fingers.tmux b/tmux-fingers.tmux index ab69fa0..eef5814 100755 --- a/tmux-fingers.tmux +++ b/tmux-fingers.tmux @@ -1,8 +1,10 @@ -#!/usr/bin/env ruby +#!/usr/bin/env bash -fingers_root = File.dirname(__FILE__) +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -redirect_to_log_file = ">>#{fingers_root}/fingers.log 2>&1" +if [ ! -f "$CURRENT_DIR/bin/tmux-fingers" ]; then + echo "tmux-fingers not found. Please run ./install.sh" + exit 1 +fi -`tmux run-shell -b "#{fingers_root}/bin/fingers load_config"` -`tmux run-shell -b "#{fingers_root}/bin/fingers check_version #{redirect_to_log_file}"` +"$CURRENT_DIR/bin/tmux-fingers" "load-config"