Commit 6d01e1c8 authored by Dylan's avatar Dylan

Added '--birthday_format' to format the output of Birthday

parent 256bdf4b
...@@ -261,6 +261,7 @@ alias fetch2="fetch \ ...@@ -261,6 +261,7 @@ alias fetch2="fetch \
--song_shorthand on/off Print the Artist/Title on seperate lines --song_shorthand on/off Print the Artist/Title on seperate lines
--birthday_shorthand on/off Shorten the output of birthday --birthday_shorthand on/off Shorten the output of birthday
--birthday_time on/off Enable/Disable showing the time in birthday output --birthday_time on/off Enable/Disable showing the time in birthday output
--birthday_format format Format the birthday output. (Uses 'date' cmd format)
Text Formatting: Text Formatting:
......
...@@ -158,6 +158,11 @@ birthday_shorthand="off" ...@@ -158,6 +158,11 @@ birthday_shorthand="off"
# --birthday_time on/off # --birthday_time on/off
birthday_time="on" birthday_time="on"
# Date format to use when printing birthday
# --birthday_format "format"
birthday_format="+%a %d %b %Y %l:%M %p"
# Color Blocks # Color Blocks
# Color block range # Color block range
......
...@@ -178,6 +178,11 @@ birthday_shorthand="off" ...@@ -178,6 +178,11 @@ birthday_shorthand="off"
# --birthday_time on/off # --birthday_time on/off
birthday_time="on" birthday_time="on"
# Date format to use when printing birthday
# --birthday_format "format"
birthday_format="%a %d %b %Y %l:%M %p"
# Color Blocks # Color Blocks
# Color block range # Color block range
...@@ -1513,12 +1518,12 @@ getbirthday () { ...@@ -1513,12 +1518,12 @@ getbirthday () {
case "$os" in case "$os" in
"Linux") "Linux")
birthday="$(ls -alct --full-time / | awk '/lost\+found/ {printf $6 " " $7}')" birthday="$(ls -alct --full-time / | awk '/lost\+found/ {printf $6 " " $7}')"
date_cmd="$(date -d"$birthday" "+%a %d %b %Y %l:%M %p")" date_cmd="$(date -d"$birthday" +"$birthday_format")"
;; ;;
"Mac OS X") "Mac OS X")
birthday="$(ls -alctT /var/log/CDIS.custom | awk '{printf $6 " " $7 " " $9 " " $8}')" birthday="$(ls -alctT /var/log/CDIS.custom | awk '{printf $6 " " $7 " " $9 " " $8}')"
date_cmd="$(date -j -f "%b %d %Y" "$birthday" "+%a %d %b %Y %l:%M %p")" date_cmd="$(date -j -f "%b %d %Y" "$birthday" +"$birthday_format")"
;; ;;
*"BSD") *"BSD")
...@@ -1530,7 +1535,7 @@ getbirthday () { ...@@ -1530,7 +1535,7 @@ getbirthday () {
"FreeBSD"*) "FreeBSD"*)
birthday="$(ls -alctT /etc/hostid | awk '{printf $6 " " $7 " " $9 " " $8}')" birthday="$(ls -alctT /etc/hostid | awk '{printf $6 " " $7 " " $9 " " $8}')"
date_cmd="$(date -j -f "%b %d %Y" "$birthday" "+%a %d %b %Y %l:%M %p")" date_cmd="$(date -j -f "%b %d %Y" "$birthday" +"$birthday_format")"
;; ;;
"NetBSD"*) "NetBSD"*)
...@@ -1546,7 +1551,7 @@ getbirthday () { ...@@ -1546,7 +1551,7 @@ getbirthday () {
"Windows") "Windows")
birthday="$(ls -alct --full-time /cygdrive/c/Windows/explorer.exe | awk '{printf $8 " " $9}')" birthday="$(ls -alct --full-time /cygdrive/c/Windows/explorer.exe | awk '{printf $8 " " $9}')"
date_cmd="$(date -d"$birthday" "+%a %d %b %Y %l:%M %p")" date_cmd="$(date -d"$birthday" +"$birthday_format")"
;; ;;
*) *)
...@@ -2302,6 +2307,7 @@ usage () { cat << EOF ...@@ -2302,6 +2307,7 @@ usage () { cat << EOF
--song_shorthand on/off Print the Artist/Title on seperate lines --song_shorthand on/off Print the Artist/Title on seperate lines
--birthday_shorthand on/off Shorten the output of birthday --birthday_shorthand on/off Shorten the output of birthday
--birthday_time on/off Enable/Disable showing the time in birthday output --birthday_time on/off Enable/Disable showing the time in birthday output
--birthday_format format Format the birthday output. (Uses 'date' cmd format)
Text Formatting: Text Formatting:
...@@ -2400,6 +2406,7 @@ while [ "$1" ]; do ...@@ -2400,6 +2406,7 @@ while [ "$1" ]; do
--song_shorthand) song_shorthand="$2" ;; --song_shorthand) song_shorthand="$2" ;;
--birthday_shorthand) birthday_shorthand="$2" ;; --birthday_shorthand) birthday_shorthand="$2" ;;
--birthday_time) birthday_time="$2" ;; --birthday_time) birthday_time="$2" ;;
--birthday_format) birthday_format="$2" ;;
--disable) --disable)
for func in "$@"; do for func in "$@"; do
case "$func" in case "$func" in
......
...@@ -74,6 +74,9 @@ Shorten the output of birthday ...@@ -74,6 +74,9 @@ Shorten the output of birthday
.TP .TP
.B \--birthday_time 'on/off' .B \--birthday_time 'on/off'
Enable/Disable showing the time in birthday output Enable/Disable showing the time in birthday output
.TP
.B \--birthday_format 'format'
Format the birthday output. (Uses 'date' cmd format)
.SH TEXT FORMATTING .SH TEXT FORMATTING
.TP .TP
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment