View Source Chr (CHR v0.2.2)

Chr module

Summary

Functions

return command history

pick up command from history record

pick up date from DateTime

pick up directory from history record

pick up time from DateTime

pick up date from history record

pick weekday from DateTime

timestamp to datetime

Functions

Link to this function

busiest_day(history_list)

View Source

busiest day

Link to this function

daily_activity(history_list)

View Source

Daily Activity

Examples

iex> Chr.daily_activity([": 1709957744:0;cat .zsh_history",": 1709968544:0;cat .zsh_history", ": 1710000944:0;cat .zsh_history"])
[
  {"01", 20},
  {"02", 0},
  {"03", 0},
  {"04", 0},
  {"05", 0},
  {"06", 0},
  {"07", 0},
  {"08", 0},
  {"09", 0},
  {"10", 0},
  {"11", 0},
  {"12", 0},
  {"13", 20},
  {"14", 0},
  {"15", 0},
  {"16", 20},
  {"17", 0},
  {"18", 0},
  {"19", 0},
  {"20", 0},
  {"21", 0},
  {"22", 0},
  {"23", 0},
  {"24", 0}
]

return command history

pick up command from history record

Examples

iex> Chr.pick_up_command(": 1707397937:0;cat ~/.zsh_history")
"cat"

iex> Chr.pick_up_command(": 1707397937:0;clear")
"clear"

pick up date from DateTime

Examples

iex> Chr.pick_up_date(~U[2021-03-31 00:00:00Z])
~D[2021-03-31]
Link to this function

pick_up_directory(string)

View Source

pick up directory from history record

Examples

iex> Chr.pick_up_directory(": 1707397937:0;cd ~/projects/chr")
"~/projects/chr"

pick up time from DateTime

Link to this function

pick_up_local_datetime(string)

View Source

pick up date from history record

Examples

iex> Chr.pick_up_local_datetime(": 1707397937:0;cat ~/.zsh_history")
~U[2024-02-08 22:12:17Z]
Link to this function

pick_up_weekday(datetime)

View Source

pick weekday from DateTime

Examples

iex> Chr.pick_up_weekday(~U[2021-03-31 00:00:00Z])
3
Link to this function

timestamp_to_datetime(timestamp)

View Source

timestamp to datetime

Examples

iex> Chr.timestamp_to_datetime("1617226800")
~U[2021-03-31 21:40:00Z]
@spec timezone_offset() :: integer()
Link to this function

top_commands(history_list, ignore_commands)

View Source

top commands

Link to this function

top_directories(history_list)

View Source

top directories

Link to this function

weekly_activity(history_list)

View Source

Weekly Activity

Examples

iex> Chr.weekly_activity([": 1709957744:0;cat .zsh_history",": 1710044144:0;cat .zsh_history"])
[monday: 0, tuesday: 0, wednesday: 0, thursday: 0, friday: 0, saturday: 20, sunday: 20]