-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c4dd5f
commit 883474c
Showing
2 changed files
with
23 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
#!/bin/bash | ||
#!/bin/env nu | ||
|
||
PREFERENCES="&include-passage-references=false&include-verse-numbers=false&include-footnotes=false&include-headings=false"; | ||
QUERY="/v3/passage/text/?q=$1"; | ||
shift; | ||
# Lookup passage from the ESV Bible | ||
def main [ | ||
--include-passage-references # Show passage references | ||
--include-verse-numbers # Show verse numbers | ||
--include-footnotes # Show the footnotes | ||
--include-headings # Show the passage headings | ||
...passage: string # Bible passage to lookup | ||
] { | ||
let headers = ["Authorization" "Token 7bf823cec4289f8fbce0b802be2cdeb22fd79c5b"] | ||
|
||
for arg in "$@"; do | ||
QUERY+="+$arg"; | ||
done | ||
|
||
VERSES=$(curl -H "Authorization: Token 7bf823cec4289f8fbce0b802be2cdeb22fd79c5b" "https://api.esv.org$QUERY$PREFERENCES" 2> /dev/null | jq -r .passages[0]) | ||
|
||
echo -e "$VERSES" | ||
{ | ||
include-passage-references: ($include_passage_references | into string) | ||
include-verse-numbers: ($include_verse_numbers | into string) | ||
include-footnotes: ($include_footnotes | into string) | ||
include-headings: ($include_headings | into string) | ||
q: ($passage | str join " ") | ||
} | ||
| url build-query | ||
| $"https://api.esv.org/v3/passage/text/?($in)" | ||
| http get $in --headers $headers | ||
| get passages | ||
| first | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ def main [ | |
| into datetime | ||
| datediff $in --weeks | ||
| into float | ||
| $in / 7 | ||
| math abs | ||
| math floor | ||
} |