Created
April 17, 2021 09:58
-
-
Save NNBnh/2e36c30a7c24d33fb3f5058f16a02c42 to your computer and use it in GitHub Desktop.
ssmana
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# __________ | |
# / ___/ ___/____ ___ ____ _____ ____ _ | |
# \__ \\__ \/ __ `__ \/ __ `/ __ \/ __ `/ | |
# ___/ /__/ / / / / / / /_/ / / / / /_/ / | |
# /____/____/_/ /_/ /_/\__,_/_/ /_/\__,_/ | |
# | |
# File: ssmana | |
# Description: Session managers | |
# Author: NNB | |
# └─ https://github.com/NNBnh | |
# URL: https://gist.github.com/NNBnh/2e36c30a7c24d33fb3f5058f16a02c42 | |
# License: GPLv3 | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <https://www.gnu.org/licenses/>. | |
# Values | |
SELECTOR='fzf' | |
SESSION_NAMING="${SSMANA_SESSION_NAMING:-ssmana_}" | |
# Start | |
selection=' | |
' | |
while [ -n "$selection" ]; do | |
sessions=$(abduco | sed -e '1d') | |
selection=$(printf "${sessions:+$sessions\n}\033[1m+ New session\033[0m" | eval "$SELECTOR --no-multi --preview-window='hidden'") | |
if [ "$selection" = '+ New session' ]; then | |
i='0' | |
while :; do | |
abduco -c "$SESSION_NAMING$i" 2>&- && break | |
i=$(( i + 1 )) | |
done | |
elif [ -n "$selection" ]; then | |
abduco -a "$(printf '%s' "$selection" | sed -e 's/^.*[0-9-]* [0-9:]*[[:space:]]//')" | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment