Last active
August 6, 2022 22:25
-
-
Save subfuzion/014ad43ea11a3b4c1ed381e946a1dcad to your computer and use it in GitHub Desktop.
macpro-files
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
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi |
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
export BASH_SILENCE_DEPRECATION_WARNING=1 | |
# iterm shell integration | |
# https://iterm2.com/documentation-shell-integration.html | |
ITERM2_SQUELCH_MARK=1 | |
iterm2_hostname=$(hostname) | |
shopt -u extdebug | |
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" | |
# (somewhat) portable personal profile | |
test -e "${HOME}/.tony.profile" && source "${HOME}/.tony.profile" |
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
# Inspirations: | |
# http://mutelight.org/practical-tmux | |
# http://zanshin.net/2013/09/05/my-tmux-configuration/ | |
# http://files.floriancrouzat.net/dotfiles/.tmux.conf | |
# http://stackoverflow.com/questions/9628435/tmux-status-bar-configuration | |
# https://github.com/Lokaltog/powerline | |
# https://github.com/remiprev/teamocil | |
# http://superuser.com/questions/74492/whats-the-best-prefix-escape-sequence-for-screen-or-tmux | |
# http://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2/ | |
# | |
set -g default-terminal "screen-256color" | |
# ***WARNING!*** tmux will exit immediately if this plugin is not installed!!! | |
# http://superuser.com/questions/397076/tmux-exits-with-exited-on-mac-os-x | |
# set-option -g default-command "reattach-to-user-namespace -l $SHELL" | |
# change default prefix (C-b) to C-space | |
unbind C-space | |
set -g prefix C-space | |
bind C-space send-prefix | |
#unbind C-k | |
#set -g prefix C-k | |
#bind C-k send-prefix | |
# start numbering from 0 instead of 1 | |
set -g base-index 0 | |
setw -g pane-base-index 0 | |
# bind C-a C-a to last active window | |
bind-key C-a last-window | |
# get rid of delay reading command characters while tmux waits for escape sequence | |
set -s escape-time 1 | |
# reload ~/.tmux.conf using prefix r | |
bind r source-file ~/.tmux.conf \; display "tmux reloaded" | |
# change split prefixes (horizontal: C-space /) (vertical: C-space -) | |
bind / split-window -h -c "#{pane_current_path}" | |
bind - split-window -v -c "#{pane_current_path}" | |
# make current window the 1st window | |
bind T swap-window -t 1 | |
# set scrollback history to 10K lines | |
set -g history-limit 10000 | |
# mouse support | |
#setw -g mode-mouse on | |
set -g mouse on | |
# https://github.com/tmux/tmux/issues/145#issuecomment-151098708 | |
#bind -n WheelUpPane if-shell -F -T = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e; send-keys -M'" | |
# https://github.com/tmux/tmux/issues/145#issuecomment-151123624 | |
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'" | |
bind -n WheelDownPane select-pane -t= \; send-keys -M | |
# vi | |
# == | |
setw -g mode-keys vi | |
set -g status-keys vi | |
# setup 'v' to begin selection as in vim | |
#bind-key -T vi-copy v begin-selection | |
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection | |
#bind-key -T vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" | |
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection | |
# update default binding of `Enter` to also use copy-pipe (os x) | |
#unbind -T vi-copy Enter | |
unbind -T copy-mode-vi 'Enter' | |
#bind-key -T vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" | |
bind-key -T copy-mode-vi 'Enter' send-keys -X copy-selection | |
# map vi movement keys as pane movement keys | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R | |
# use vi left and right to cycle thru panes | |
bind -r C-h select-window -t :- | |
bind -r C-l select-window -t :+ | |
# resize panes using vi keys | |
bind -r H resize-pane -L 5 | |
bind -r J resize-pane -D 5 | |
bind -r K resize-pane -U 5 | |
bind -r L resize-pane -R 5 | |
# status bar | |
# ========== | |
# set status bar | |
#set -g status-justify centre | |
set -g status-justify left | |
#set -g status-left "" | |
#set -g status-right "#[fg=green]#H" | |
# dark theme | |
#set -g status-bg "#101010" | |
#set -g status-fg "#005000" | |
# light theme | |
#set -g status-bg "#222222" | |
set -g status-bg "#303030" | |
set -g status-fg "#009000" | |
# show host name and IP address on left side of status bar | |
# set -g status-left-length 70 | |
# informational (but takes room) | |
# set -g status-left "#h #(curl -4 https://icanhazip.com) #(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') " | |
# show session name, window & pane number, date and time on right | |
# of status bar | |
#set -g status-right-length 60 | |
# set -g status-right "#S #I:#P %d %b %Y %l:%M %p (#(date -u | awk '{print $4}' | cut -c1-5))" | |
set -g status-right "" | |
set-option -g set-titles on | |
# Highlight active window | |
setw -g window-status-current-style fg=black | |
setw -g window-status-current-style fg=green | |
# quiet! | |
# http://unix.stackexchange.com/questions/169992/why-are-my-windows-highlighted-when-i-first-open-tmux | |
setw -g monitor-activity off | |
set -g monitor-silence 0 | |
set -g bell-action none | |
set -g visual-activity off | |
set -g visual-bell off | |
set -g visual-silence off | |
set -g bell-action none |
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
#set -uo | |
# make sure we are running bash | |
if [ -z "$BASH_VERSION" ]; then | |
echo "error: not a bash shell" | |
exit 1 | |
fi | |
export EDITOR=vim | |
# ====================================================================== | |
# if this is a login shell, set up PATH | |
#shopt -q login_shell | |
#if [[ $? == 0 ]]; then | |
# commented out the above because Intellij terminal won't start a login shell | |
unset PATH | |
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin | |
export PATH=$PATH:/usr/local/git/bin | |
export PATH=$PATH:/usr/local/go/bin | |
export PATH=$PATH:/usr/local/share/dotnet:$HOME/.dotnet/tools | |
# bazel | |
# completion at the end | |
# dart | |
export DARTSDK=$HOME/dart/sdk/dartsdk/dart-sdk | |
export DARTDOCS=$HOME/dart/sdk/dartdocs/gen-dartdocs | |
export PATH=$PATH:$DARTSDK/bin | |
export PATH=$PATH:$HOME/.pub-cache/bin | |
# direnv | |
# https://direnv.net/ | |
#eval "$(direnv hook bash)" | |
# flutter (flutter completion at the end) | |
export FLUTTER_HOME=$HOME/projects/flutter/flutter | |
export PATH=$PATH:$FLUTTER_HOME/bin | |
# gem | |
# https://guides.cocoapods.org/using/getting-started.html#installation | |
export GEM_HOME=$HOME/.gem | |
export PATH=$PATH:$GEM_HOME | |
# github-cli | |
#export GH=$HOME/bin/gh_1.2.1_macOS_amd64 | |
#export PATH=$PATH:$GH/bin | |
# hgd (fig/mercurial) | |
# https://g3doc.corp.google.com/codelab/fig/g3doc/index.md?cl=head | |
# completion at the end | |
# java | |
export PATH="/usr/local/opt/openjdk@8/bin:$PATH" | |
export CPPFLAGS="-I/usr/local/opt/openjdk@8/include" | |
# maven | |
export PATH=$HOME/java/maven/apache-maven-3.6.3/bin:$PATH | |
# graalvm | |
# https://quarkus.io/guides/building-native-image#configuring-graalvm | |
export GRAALVM_HOME=$HOME/java/graalvm/graalvm-ce-java11-20.0.0/Contents/Home | |
# NOTE: java, node, etc path is hidden if graal bin path is last | |
export PATH=$PATH:${GRAALVM_HOME}/bin | |
# export PATH=${GRAALVM_HOME}/bin:$PATH | |
# Google Cloud SDK (gcloud) | |
export GCLOUD_HOME=$HOME/google-cloud-sdk | |
export PATH=$GCLOUD_HOME/bin:$PATH | |
export PATH=$PATH:$GCLOUD_HOME/bin | |
# https://cloud.google.com/logging/docs/reference/tools/gcloud-logging#live-tailing | |
export CLOUDSDK_PYTHON_SITEPACKAGES=1 | |
# go | |
# explicitly set GOPATH for those tools that still check the environment variable | |
export GOPATH=$(go env GOPATH) | |
export PATH=$HOME/go/bin:$PATH | |
export PATH=$PATH:~/go/bin | |
# deno | |
# completions at the end | |
export PATH=$PATH:~/.deno/bin | |
# node | |
# HIDE graalvm node path !!! | |
# completions at the end | |
# npm - no sudo | |
# https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally | |
export PATH=$PATH:~/.npm-global/bin | |
# nvm | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
# completion at the end | |
# pack | |
# completion at the end | |
# protoc | |
export PROTOC_HOME=~/grpc/protoc | |
export PATH="$PATH:$PROTOC_HOME/bin" | |
export PATH="$PATH:$HOME/.pub-cache/bin" | |
# python | |
export PATH="$PATH:/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/bin" | |
# ------ | |
# precedence goes to $HOME/bin | |
# ensures can always shadow an installed version with one in $HOME/bin, if so desired | |
export PATH=$HOME/bin:$PATH | |
# be careful with this and comment out when it doubt | |
# convenient during development to have a local version in ./bin or . shadow any other versions | |
export PATH=.:./bin:$PATH | |
# override mac with gnu versions | |
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" | |
# commented out test for login shell | |
#fi | |
# ====================================================================== | |
# for any bash shell... | |
# macos: brew install coreutils | |
alias dircolors=gdircolors | |
export LS_COLORS=$(dircolors) | |
# my bash prompt | |
#PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ " | |
#PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$ " | |
PS1="\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]tony\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n$ " | |
LS_COLORS=$LS_COLORS:'ln=0;31:' | |
# cd to actual dir of symlinked dir | |
# function cdl { local dir=$(readlink -e $1); [[ -n "$dir" ]] && cd "$dir"; } | |
alias cd='cd -P' | |
alias g4=p4 | |
alias l='ls -lFhv' | |
alias ll='ls -lAFhv' | |
export USER_CONFIG=$HOME/.bash_profile | |
export LINUX_HOSTNAME=subfuzion | |
function renew_gcert_ifneeded() { | |
# Ensures the certificate will last a standard workday | |
HOURS_TILL_EOB=$((20 - $(date +%-H)))h | |
gcertstatus -ssh_cert_comment=corp/normal -check_remaining=$HOURS_TILL_EOB || gcert | |
} | |
function renew_bagpipe_ifneeded() { | |
p4 info > /dev/null 2>&1 || p4 bagpipe-prodaccess | |
} | |
function prodaccess() { | |
# Bagpipe to workstation or cloudtop | |
# https://g3doc.corp.google.com/corp/access/ssh/helper/g3doc/index.md | |
# https://g3doc.corp.google.com/devtools/piper/g3doc/public/bagpipe.md?cl=head#bagpipe-with-a-cloudtop-instance-as-server | |
# https://g3doc.corp.google.com/codelab/piper/g3doc/macos.md?cl=head | |
. $HOME/.bagpipe/setup.sh $HOME/.bagpipe subfuzion.c.googlers.com "corp-ssh-helper -relay=sup-ssh-relay.corp.google.com --stderrthreshold=INFO %h %p" | |
. $HOME/.bagpipe/setup.sh $HOME/.bagpipe subfuzion "corp-ssh-helper -relay=sup-ssh-relay.corp.google.com --stderrthreshold=INFO %h %p" | |
# https://g3doc.corp.google.com/devtools/citc/g3doc/mac.md?cl=head | |
# avoid unbound variable | |
ZSH_VERSION="" | |
. /Library/GoogleCorpSupport/srcfs/shell_completion/enable_completion.sh | |
renew_gcert_ifneeded && renew_bagpipe_ifneeded && cd . | |
# TODO: if fails, try restart_bagpipe | |
} | |
function kill_bagpiped() { | |
ps -x | grep bagpipe_daemon | awk '{print $1}' | xargs kill | |
} | |
export P4CONFIG=.p4config | |
export P4EDITOR=vi | |
#function g4d() { | |
# cd $(p4 g4d $1) | |
#} | |
# read the following if need p4_depot_paths support for OS X / iOS projects | |
# https://g3doc.corp.google.com/codelab/piper/g3doc/macos.md#adding-views-local-disk-only | |
function pf() { | |
ssh [email protected] -L $1:subfuzion.c.googlers.com:${2:-$1} | |
} | |
# what changelist am I synced to? | |
# go/p4faq#showcurrentchangelist | |
function cl() { | |
p4 --format '%SyncChange%' client -o | |
} | |
# go/srcfs-on-mac#restarting-the-srcfs-daemon | |
function restart_bagpipe() { | |
sudo launchctl unload /Library/LaunchDaemons/com.google.corp.srcfs.plist | |
sudo launchctl load /Library/LaunchDaemons/com.google.corp.srcfs.plist | |
} | |
# jetbrains intellij idea ultimate | |
function icepick() { | |
sudo mkdir -p /var/spool/icepick | |
icepick_client corp-license-hosting | |
} | |
function reload() { | |
exec -l $SHELL | |
} | |
alias gb='git branch' | |
alias gc='git checkout' | |
alias gr='git rebase' | |
alias gs='git status -u' | |
function watchmtls { | |
watch -n 1 'status=$(nomos status) && printf "%s\n\n" "$status" && printf "cluster1: " && kubectl get destinationrule default -n istio-system --context '${names[0]}' -o yaml | grep "mode: " && printf "cluster2: " && kubectl get destinationrule default -n istio-system --context '${names[1]}' -o yaml | grep "mode: "' | |
} | |
# Google Cloud SDK (gcloud) | |
if [ -f "$HOME/google-cloud-sdk/path.bash.inc" ]; then . "$HOME/google-cloud-sdk/path.bash.inc"; fi | |
if [ -f "$HOME/google-cloud-sdk/completion.bash.inc" ]; then . "$HOME/google-cloud-sdk/completion.bash.inc"; fi | |
export GOOGLE_PROJECT_FOLDER=130886061063 | |
# gcloud beta billing accounts list | |
# devrel-anthos-demos | |
export GCLOUD_BILLING_ACCOUNT=017FC3-D561B3-68DD84 | |
function gcloud-projects-create() { | |
[[ -z $1 ]] && echo "error: missing arg; usage: gcloud-projects-create PROJECT" && exit 1 | |
local project=$1 | |
gcloud projects create --folder=$GOOGLE_PROJECT_FOLDER "$@" | |
gcloud beta billing projects link $project --billing-account=$GCLOUD_BILLING_ACCOUNT | |
} | |
function gcloud-projects-create-default() { | |
[[ -z $1 ]] && echo "error: missing arg; usage: gcloud-projects-create PROJECT" && exit 1 | |
gcloug-projects-create --set-as-default | |
} | |
function gcloud-projects-enable-billing() { | |
local project=$(gcloud config get-value core/project) | |
gcloud beta billing projects link $project --billing-account=$GCLOUD_BILLING_ACCOUNT | |
} | |
function gcloud-projects-list() { | |
local filter="${1:-tonypujals*}" | |
gcloud projects list --format="table(name,projectId,projectNumber,createTime)" --filter=projectId:$filter | |
} | |
function gcloud-projects-list-flat() { | |
local filter="${1:-tonypujals*}" | |
gcloud projects list --format="table(name,projectId,projectNumber,createTime)" --filter=projectId:$filter --format=flattened | |
} | |
alias watch='watch -t' | |
#function brew() { | |
# fixbrew | |
# \brew $@ | |
#} | |
function dartdocs() { | |
open $DARTDOCS/index.html | |
} | |
# dart build | |
function db() { | |
dart run build_runner build --delete-conflicting-outputs | |
} | |
# dart run | |
function dr() { | |
dart run "$@" | |
} | |
# dart activate | |
function da() { | |
local p="${1:-$PWD}" | |
dart pub global activate --overwrite -s path "$p" | |
} | |
# dart upgrade | |
function dart-upgrade() { | |
pushd ~/dart/sdk | |
./download-dart.sh "$@" | |
popd | |
} | |
# markdown lint | |
function mdlint() { | |
markdownlint-cli2-fix "**/*.md" | |
} | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
PS1="\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]tony\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$(parse_git_branch)\[\033[00m\]\n$ " | |
LS_COLORS=$LS_COLORS:'ln=0;31:' | |
export PATH=$HOME/bin:$PATH | |
# clear scrollback | |
alias cs="printf '\e[3J'" | |
alias ccs="clear && cs" | |
export DEVREL_BILLING_ACCOUNT=017FC3-D561B3-68DD84 | |
export JOONIX_BILLING_ACCOUNT=0145C0-557C58-C970F3 | |
# return | |
# bash completions | |
# https://discourse.brew.sh/t/bash-completion-2-vs-brews-auto-installed-bash-completions/2391/2 | |
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d" 2>/dev/null | |
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh" | |
#if [[ -e "/usr/local/share/bash-completion/bash_completion" ]]; then | |
# export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d" | |
# source "/usr/local/share/bash-completion/bash_completion" | |
#elif [[ -e "/usr/local/etc/profile.d/bash_completion.sh" ]]; then | |
# source "/usr/local/etc/profile.d/bash_completion.sh" | |
#elif [[ -e "/etc/bash_completion" ]]; then | |
# source "/etc/bash_completion" | |
#fi | |
. ~/.bazel/bin/bazel-complete.bash | |
. <($FLUTTER_HOME/bin/flutter bash-completion) | |
. /etc/bash_completion.d/hgd | |
#deno completions bash > /usr/local/etc/bash_completion.d/deno.bash | |
#source /usr/local/etc/bash_completion.d/deno.bash | |
#node --completion-bash > /usr/local/etc/bash_completion.d/node.bash | |
#source /usr/local/etc/bash_completion.d/node.bash | |
command -v pack >/dev/null && . $(pack completion) | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" | |
# kubectl | |
source <(kubectl completion bash) | |
alias k=kubectl | |
complete -F __start_kubectl k | |
# knative | |
source <(kn completion bash) | |
source <(deno completions bash) | |
# https://docs.python.org/3/library/venv.html#module-venv | |
venv() { | |
python3 -m venv .venv | |
source .venv/bin/activate | |
} | |
activate() { | |
source ./.venv/bin/activate | |
} | |
source <(skaffold completion bash) | |
#export PROJECT_ID=tpujals-autopilot-demo-1 | |
#export CLUSTER_ID=autopilot-plus-metrics | |
export PROJECT_ID=autopilot-voting-demo | |
export CLUSTER_ID=autopilot-demo-cluster-v3 | |
export REGION=us-central1 |
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
set novisualbell | |
set noerrorbells | |
let g:netrw_banner=0 |
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/bash | |
VERSION="$1" | |
CHANNEL="${CHANNEL:-dev}" | |
PLATFORM="${PLATFORM:-macos}" | |
ARCH="${ARCH:-x64}" | |
BASEURL="https://storage.googleapis.com/dart-archive/channels" | |
DARTSDK="dartsdk-$PLATFORM-$ARCH-release.zip" | |
DARTDOCS="dartdocs-gen-api.zip" | |
function err() { | |
echo "Error:" "$@" | |
echo "Try to download a valid version from: https://dart.dev/tools/sdk/archive," | |
echo "or run command with no arguments and let it download the latest" | |
exit 1 | |
} | |
function get_latest() { | |
local version=$(curl -s "$BASEURL/$CHANNEL/release/latest/VERSION" \ | |
| grep '"version":' \ | |
| sed -E 's/.*"([^"]+)".*/\1/' \ | |
| grep '^[[:digit:]].*' \ | |
| head -n1) | |
# echo "Checking: $BASEURL/$CHANNEL/release/latest/VERSION" | |
echo "$version" | |
} | |
function download_sdk() { | |
local version="$1" | |
echo "download sdk: $DARTSDK, version: $version" | |
local url="$BASEURL/$CHANNEL/release/$version/sdk/$DARTSDK" | |
echo $url | |
status=$(curl -O -L "$url" -w "%{http_code}") | |
(( status != 200 )) && err "HTTP status code: $status" | |
rm -rf dartsdk | |
unzip "$DARTSDK" -d dartsdk && rm "$DARTSDK" | |
} | |
function download_docs() { | |
local version="$1" | |
echo "download docs: $DARTDOCS" | |
curl -O -L "$BASEURL/$CHANNEL/release/$version/api-docs/$DARTDOCS" | |
rm -rf dartdocs | |
unzip -o "$DARTDOCS" -d dartdocs && rm "$DARTDOCS" | |
command -v open >/dev/null && [ -f dartdocs/gen-dartdocs/index.html ] && open "dartdocs/gen-dartdocs/index.html" | |
} | |
function download() { | |
local version="${1:-$(get_latest)}" | |
echo $version | |
download_sdk "$version" | |
download_docs "$version" | |
} | |
function main() { | |
local target="${1:-$(get_latest)}" | |
local current=$(dart --version 2>&1 | cut -d ' ' -f 4) | |
# or: local current=$(dart --version 2>&1 | sed -n 's/^[^[:digit:]]*\([^[:space:]]*\).*$/\1/p') | |
if [[ "$current" == "$target" ]]; then | |
echo "Latest version already installed: $current" | |
else | |
download "$target" | |
[[ -n "$current" ]] \ | |
&& echo "Upgraded Dart from previous version: $current to: $target" \ | |
|| echo "Installed Dart version: $target" | |
fi | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment