From 2ce2aea86fa8ad9b944b988474f2fc5716b94382 Mon Sep 17 00:00:00 2001 From: Parham Alvani Date: Sat, 21 Oct 2023 20:35:02 +0000 Subject: [PATCH] feat: add fish installation --- fish/conf.d/smapp.fish | 17 +++++++++++++++++ fish/config.fish | 13 +++++++++++++ scripts/fish.sh | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 fish/conf.d/smapp.fish create mode 100644 fish/config.fish create mode 100644 scripts/fish.sh diff --git a/fish/conf.d/smapp.fish b/fish/conf.d/smapp.fish new file mode 100644 index 000000000..a78589429 --- /dev/null +++ b/fish/conf.d/smapp.fish @@ -0,0 +1,17 @@ +function killsh --argument 1 + lsof -ti:"$1" | xargs kill -9 +end + +function fwdpg --argument 1 2 + ssh -N -f -L "$2":localhost:"$2" ubuntu@os-playground"$1" +end + +function pg --argument 1 + ssh os-playground"$1" +end + +function fwdhulk --argument 1 + ssh -N -f -L "$1":localhost:"$1" hulk +end + +alias hulk="ssh hulk" diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 000000000..a6659a4ce --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,13 @@ +if status is-interactive + # Commands to run in interactive sessions can go here +end + +switch (uname) + case Darwin + eval "$(/opt/homebrew/bin/brew shellenv)" +end + +starship init fish | source + +fish_add_path $HOME/bin +fish_add_path $HOME/.local/bin diff --git a/scripts/fish.sh b/scripts/fish.sh new file mode 100644 index 000000000..03fe70c5a --- /dev/null +++ b/scripts/fish.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +usage() { + echo -n -e "The user-friendly command line shell" + + # shellcheck disable=1004,2016 + echo ' + __ _ _ + / _(_)___| |__ +| |_| / __| |_ \ +| _| \__ \ | | | +|_| |_|___/_| |_| + + ' +} + +main_pacman() { + require_pacman fish +} + +main_brew() { + require_brew fish +} + +main() { + if [ ! -f ~/.config/fish/conf.d/omf.fish ]; then + curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish + fi + + grep "fish" /etc/shells || which fish | sudo tee -a /etc/shells + + configfile "fish" "config.fish" +} + +main_elahe() { + configfile "fish/conf.d" "smapp.fish" +}