Skip to content

Instantly share code, notes, and snippets.

@efraintorlo
Last active August 2, 2016 19:44
Show Gist options
  • Select an option

  • Save efraintorlo/9143bd42afdc45f4845f9bb081fe9895 to your computer and use it in GitHub Desktop.

Select an option

Save efraintorlo/9143bd42afdc45f4845f9bb081fe9895 to your computer and use it in GitHub Desktop.
Odrive status for zsh
# check this ys.zsh-theme fork:
# https://github.com/elchinot7/dotfiles/blob/master/ys-modified-chinot7.zsh-theme
# This can be used to show the Odrive Sync status in Linux/OSX
# Add the line:
# ${odrive_info} \
# to the string PROMPT
# Odrive status
local odrive_info='$(ys_prompt_odrive)'
ys_prompt_odrive() {
local has_odrive="$(type odrive > /dev/null)"
if $has_odrive; then
local odrive_status="$(odrive syncstate . | head -1)"
if [[ $odrive_status == *"Not Sync"* ]]; then
echo -n "%{$fg[red]%}(odrive x) %{$reset_color%}"
elif [[ $odrive_status == *"Synced"* ]]; then
echo -n "%{$fg[green]%}(odrive o) %{$reset_color%}"
elif [[ $odrive_status == *"Active"* ]]; then
echo -n "%{$fg[yellow]%}(odrive >>) %{$reset_color%}"
fi
else
echo -n ""
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment