Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
upgrade to work with elvish 0.17
  • Loading branch information
jkbr-19 authored Dec 15, 2021
1 parent cceb459 commit a7df41d
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions date-elv.elv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use str
#Sindarin or Quenya Dates
fn date-elv [ option format ]{
fn date-elv {| option format |
#date-elv "option format"
#A function to print the date with elvish (Sindarin or Quenya) weekday and month names
#works pretty much like date +"format" except:
Expand All @@ -11,11 +11,11 @@ fn date-elv [ option format ]{
# -Q selects language as Quenya
# -S selects language as Sindarin

day-dict = []
mon-dict = []
var day-dict = []
var mon-dict = []

if (==s "-S" $option) {
day-dict = [
set day-dict = [
&Saturday="Orgillion"
&Sunday="Oranor"
&Monday="Orithil"
Expand All @@ -25,7 +25,7 @@ fn date-elv [ option format ]{
&Friday="Oraeron"
]

mon-dict = [
set mon-dict = [
&January="Narwain"
&February="Nínui"
&March="Gwaeron"
Expand All @@ -40,7 +40,7 @@ fn date-elv [ option format ]{
&December="Girithron"
]
} elif (==s "-Q" $option) {
day-dict = [
set day-dict = [
&Saturday="Elenya"
&Sunday="Anarya"
&Monday="Isilya"
Expand All @@ -50,7 +50,7 @@ fn date-elv [ option format ]{
&Friday="Earenya"
]

mon-dict = [
set mon-dict = [
&January="Narvinye"
&February="Nénime"
&March="Súlime"
Expand All @@ -70,14 +70,14 @@ fn date-elv [ option format ]{
}

#seconds since '70
sec = (echo '@'(date +'%s'))
var sec = (echo '@'(date +'%s'))
#fetches the current abbreviated day names, and number of month
per-A = (date --date=$sec +"%A")
per-B = (date --date=$sec +"%B")
day-sin = $day-dict[$per-A]
mon-sin = $mon-dict[$per-B]
format = (str:replace "%A" $day-sin $format)
format = (str:replace "%B" $mon-sin $format)
var per-A = (date --date=$sec +"%A")
var per-B = (date --date=$sec +"%B")
var day-sin = $day-dict[$per-A]
var mon-sin = $mon-dict[$per-B]
set format = (str:replace "%A" $day-sin $format)
set format = (str:replace "%B" $mon-sin $format)

date --date=$sec +$format
}

0 comments on commit a7df41d

Please sign in to comment.