Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom timestamp format in history #6770

Merged
merged 2 commits into from
Jul 13, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
lib/history: simply case logic
  • Loading branch information
mcornella authored Jul 13, 2018
commit e510030a4390fea33f704350f90c0df1ff4dbf18
17 changes: 7 additions & 10 deletions lib/history.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ function omz_history {
}

# Timestamp format
if [ ! -z "$HIST_STAMPS" ]; then
case $HIST_STAMPS in
"mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='omz_history -i' ;;
*) alias history='omz_history -t "$HIST_STAMPS"' ;;
esac
else
alias history='omz_history'
fi
case $HIST_STAMPS in
"mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='omz_history -i' ;;
"") alias history='omz_history' ;;
*) alias history="omz_history -t '$HIST_STAMPS'" ;;
esac

## History file configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
Expand Down