Birthday: Rename get_birthday() to get_install_date()
This commit is contained in:
parent
d375aa24d6
commit
2490a45293
|
@ -39,7 +39,7 @@ print_info() {
|
|||
# info "Local IP" local_ip
|
||||
# info "Public IP" public_ip
|
||||
# info "Users" users
|
||||
# info "Birthday" birthday
|
||||
# info "Install Date" install_date
|
||||
|
||||
info line_break
|
||||
info cols
|
||||
|
@ -292,19 +292,19 @@ public_ip_host="http://ident.me"
|
|||
song_shorthand="off"
|
||||
|
||||
|
||||
# Birthday
|
||||
# Install Date
|
||||
|
||||
|
||||
# Whether to show the time in the output
|
||||
#
|
||||
# Default: 'on'
|
||||
# Values: 'on', 'off'
|
||||
# Flag: --birthday_time
|
||||
# Flag: --install_time
|
||||
#
|
||||
# Example:
|
||||
# on: 'Thu 14 Apr 2016 11:50 PM'
|
||||
# off: 'Thu 14 Apr 2016'
|
||||
birthday_time="on"
|
||||
install_time="on"
|
||||
|
||||
|
||||
# Text Colors
|
||||
|
|
|
@ -33,7 +33,7 @@ print_info() {
|
|||
info "Local IP" local_ip
|
||||
info "Public IP" public_ip
|
||||
info "Users" users
|
||||
info "Birthday" birthday
|
||||
info "Install Date" install_date
|
||||
|
||||
info line_break
|
||||
info cols
|
||||
|
|
38
neofetch
38
neofetch
|
@ -1726,51 +1726,51 @@ get_users() {
|
|||
users="${users%\,*}"
|
||||
}
|
||||
|
||||
get_birthday() {
|
||||
get_install_date() {
|
||||
case "$os" in
|
||||
"Linux" | "GNU" | "iPhone OS")
|
||||
birthday="$(ls -alct --full-time / | awk '/lost\+found|private/ {printf $6 " " $7}')"
|
||||
install_date="$(ls -alct --full-time / | awk '/lost\+found|private/ {printf $6 " " $7}')"
|
||||
;;
|
||||
|
||||
"Mac OS X")
|
||||
birthday="$(ls -lUT /var/log/install.log | awk '{printf $9 " " $6 " " $7 " " $8}')"
|
||||
install_date="$(ls -lUT /var/log/install.log | awk '{printf $9 " " $6 " " $7 " " $8}')"
|
||||
;;
|
||||
|
||||
"BSD")
|
||||
case "$kernel_name" in
|
||||
"OpenBSD"* | "Bitrig"*)
|
||||
birthday_file="/"
|
||||
install_file="/"
|
||||
;;
|
||||
|
||||
"FreeBSD"*)
|
||||
birthday_file="/etc/hostid"
|
||||
install_file="/etc/hostid"
|
||||
;;
|
||||
|
||||
"NetBSD"* | "DragonFly"*)
|
||||
birthday_file="/etc/defaults/rc.conf"
|
||||
install_file="/etc/defaults/rc.conf"
|
||||
;;
|
||||
esac
|
||||
|
||||
birthday="$(ls -alctT "$birthday_file" | awk '{printf $9 " " $6 " " $7 " " $8 " "}')"
|
||||
install_date="$(ls -alctT "$install_file" | awk '{printf $9 " " $6 " " $7 " " $8 " "}')"
|
||||
;;
|
||||
|
||||
"Windows")
|
||||
birthday="$(ls -alct --full-time /cygdrive/c/Windows/explorer.exe | awk '{printf $8 " " $9}')"
|
||||
install_date="$(ls -alct --full-time /cygdrive/c/Windows/explorer.exe | awk '{printf $8 " " $9}')"
|
||||
;;
|
||||
|
||||
"Solaris")
|
||||
birthday="$(ls -alct --full-time /var/sadm/system/logs/install_log | awk '{printf $6 " " $7}')"
|
||||
install_date="$(ls -alct --full-time /var/sadm/system/logs/install_log | awk '{printf $6 " " $7}')"
|
||||
;;
|
||||
|
||||
"Haiku")
|
||||
birthday="$(ls -alctd --full-time /boot | awk '{printf $6 " " $7}')"
|
||||
install_date="$(ls -alctd --full-time /boot | awk '{printf $6 " " $7}')"
|
||||
;;
|
||||
esac
|
||||
|
||||
birthday="${birthday//-/ }"
|
||||
birthday="${birthday%:*}"
|
||||
birthday=($birthday)
|
||||
birthday="$(convert_time "${birthday[@]}")"
|
||||
install_date="${install_date//-/ }"
|
||||
install_date="${install_date%:*}"
|
||||
install_date=($install_date)
|
||||
install_date="$(convert_time "${install_date[@]}")"
|
||||
}
|
||||
|
||||
get_cols() {
|
||||
|
@ -2883,6 +2883,8 @@ old_functions() {
|
|||
get_publicip() { get_public_ip; publicip="$public_ip"; }
|
||||
get_linebreak() { get_line_break; linebreak="$line_break"; }
|
||||
fi
|
||||
|
||||
get_birthday() { get_install_date; birthday="$install_date"; }
|
||||
}
|
||||
|
||||
old_options() {
|
||||
|
@ -2970,9 +2972,9 @@ convert_time() {
|
|||
esac
|
||||
|
||||
# Toggle showing the time
|
||||
[[ "$birthday_time" == "off" ]] && unset time
|
||||
[[ "$install_time" == "off" ]] && unset time
|
||||
|
||||
# Print the birthday.
|
||||
# Print the install date.
|
||||
printf "%s" "$week_day $day $month $year $time"
|
||||
}
|
||||
|
||||
|
@ -3034,7 +3036,7 @@ INFO
|
|||
--shell_version on/off Enable/Disable showing \$SHELL version
|
||||
--ip_host url URL to query for public IP
|
||||
--song_shorthand on/off Print the Artist/Title on seperate lines
|
||||
--birthday_time on/off Enable/Disable showing the time in birthday output.
|
||||
--install_time on/off Enable/Disable showing the time in Install Date output.
|
||||
|
||||
TEXT FORMATTING
|
||||
|
||||
|
@ -3203,7 +3205,7 @@ get_args() {
|
|||
"--shell_version") shell_version="$2" ;;
|
||||
"--ip_host") public_ip_host="$2" ;;
|
||||
"--song_shorthand") song_shorthand="$2" ;;
|
||||
"--birthday_time") birthday_time="$2" ;;
|
||||
"--install_time") install_time="$2" ;;
|
||||
"--disable")
|
||||
for func in "$@"; do
|
||||
case "$func" in
|
||||
|
|
|
@ -89,8 +89,8 @@ URL to query for public IP
|
|||
\fB\-\-song_shorthand\fR on/off
|
||||
Print the Artist/Title on seperate lines
|
||||
.TP
|
||||
\fB\-\-birthday_time\fR on/off
|
||||
Enable/Disable showing the time in birthday output.
|
||||
\fB\-\-install_time\fR on/off
|
||||
Enable/Disable showing the time in Install Date output.
|
||||
.PP
|
||||
TEXT FORMATTING
|
||||
.TP
|
||||
|
|
Reference in New Issue