🚸 Add flags for skip/ow/backup all

This commit is contained in:
Marley Rae 2024-01-30 20:18:54 -08:00
parent d8dc2eab47
commit fc242d841e
6 changed files with 128 additions and 3 deletions

View file

@ -4,6 +4,13 @@ mar does dotfiles
# post install
## Casks
```fish
open /usr/local/Caskroom/windscribe/[#.#.#]/windscribeInstaller.app
```
## iTerm2
Set iTerm2 to use the preferences folder ~/dotfiles/os/.

53
os/apt_utils.fish Normal file
View file

@ -0,0 +1,53 @@
#!/usr/bin/env fish
source "$DOT/script/utils.fish"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function package_is_installed -a pkg
dpkg -s "$pkg" &>/dev/null
end
function install_package -a pkg_readable_name pkg args
if ! package_is_installed "$pkg"
execute \
"sudo apt-get install --allow-authenticated -qqy $args $pkg" "$pkg_readable_name"
# suppress output ─┘│
# assume "yes" as the answer to all prompts ──┘
else
print_success "$pkg_readable_name"
end
end
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function add_key -a key
wget -q0 - "$key" | sudo apt-key add - &> /dev/null
# │└─ write output to file
# └─ don't show output
end
function add_ppa -a ppa
sudo add-apt-repository -y ppa:"$ppa" &>/dev/null
end
function add_to_source_list -a source list
sudo sh -c "printf 'deb $source' >> '/etc/apt/sources.list.d/$list'"
end
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function apt_update
execute "sudo apt-get update -qqy" "APT (update)"
end
function apt_upgrade
execute \
"export DEBIAN_FRONTEND=\"noninteractive\" \
&& sudo apt-get -o Dpkg::Options::=\"--force-confnew\" upgrade -qqy" \
"APT (upgrade)"
end
function apt_autoremove
execute "sudo apt-get autoremove -qqy" "APT (autoremove)"
end

31
os/install.fish Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env fish
source "$DOT/script/utils.fish"
source "$DOT/homebrew/brew_utils.fish"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_subtitle "OS"
if [ "$(uname)" = "Darwin" ]
brew_install "mas-cli" "mas"
brew_install "Rectangle" "rectangle" "--cask"
execute "mas install 1563735522" "Charmstone"
brew_install "Windscribe" "windscribe" "--cask"
brew_install "Firefox" "firefox" "--cask"
brew_install "qBittorrent" "qbittorrent" "--cask"
brew_install "Discord" "discord" "--cask"
brew_install "BetterDiscord" "betterdiscord-installer" "--cask"
brew_install "Obsidian" "obsidian" "--cask"
brew_install "Fantastical" "fantastical" "--cask"
brew_install "iTerm2" "iterm2" "--cask"
brew_install "Laravel Herd" "herd" "--cask"
brew_install "DBngin" "dbngin" "--cask"
brew_install "PhpStorm" "phpstorm" "--cask"
brew_install "WebStorm" "webstorm" "--cask"
end

11
php/install.fish Normal file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env fish
source "$DOT/script/utils.fish"
source "$DOT/homebrew/brew_utils.fish"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [ "$(uname)" = "Darwin" ]
brew_install "Laravel Herd" "herd" "--cask"
brew_install "PhpStorm" "phpstorm" "--cask"
end

View file

@ -1,8 +1,9 @@
#!/usr/bin/env fish
# vim:set ft=fish :
set -q DOT || set -gx DOT "$HOME/dotfiles"
set -g yes_to_all false
source "$DOT/script/utils.fish"
################################################################################
@ -106,9 +107,23 @@ end
function install_dotfiles
print_title "Installing Dotfiles"
set -g skip_all false
set -g overwrite_all false
set -g backup_all false
set -g skip_all false
if set -q yes_to_all && $yes_to_all
set skip_all true
else if set -q _flag_s
set skip_all true
end
if set -q _flag_o
set overwrite_all true
end
if set -q _flag_b
set backup_all true
end
set -l path (string replace -a '/' '\/' "$DOT")
set -l regex (string join '' '^' "$path" '\/[a-zA-Z]+\/(.+)\.(sym|hard)link$')
@ -119,9 +134,17 @@ function install_dotfiles
end
################################################################################
# Main #
# Main #
################################################################################
argparse "y/yes-to-all" "s/skip" "o/overwrite" "b/backup" -- $argv
if set -q _flag_y
set yes_to_all true
end
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Ensure npm is available.
"$DOT/node/volta.fish"