[A] trouble shooting for gdate on macOS

This commit is contained in:
chesteryue 2020-04-26 15:36:15 +08:00
parent a24c93e9e0
commit e9e23e4c3d
2 changed files with 19 additions and 0 deletions

View file

@ -9,3 +9,10 @@ An oh-my-zsh theme.
## Usage
REF: [Oh-My-Zsh External themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes)
### Trouble Shooting
#### macOS
passsion.zsh-theme uses cmd ```gdate``` to get current time in milliseconds which is not installed default in macOS.
run ```brew install coreutils;``` to get ```gdate```;

View file

@ -1,4 +1,16 @@
# gdate for macOS
# REF: https://apple.stackexchange.com/questions/135742/time-in-milliseconds-since-epoch-in-the-terminal
if [[ "$OSTYPE" == "darwin"* ]]; then
{
gdate
} || {
echo "\n$fg_bold[yellow]zsh theme passion needs gdate in coreutils:$reset_color"
echo "$fg_bold[green]brew install coreutils;\n$reset_color";
}
fi
# time
function real_time() {
local color="%{$fg_no_bold[cyan]%}"; # color in PROMPT need format in %{XXX%} which is not same with echo