Initial commit
This commit is contained in:
commit
c0f4b3c979
1 changed files with 29 additions and 0 deletions
29
gatsbyfeed
Normal file
29
gatsbyfeed
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
#Name : gatsbyfeed
|
||||
#Usage : Extract jsonfeed from gatsbyjs agenda
|
||||
|
||||
function to_feed(){
|
||||
curl -s $link | jq '{"version":"https://jsonfeed.org/version/1.1", "title":"RDS", "home_page_url": "https://example.org/", "feed_url": "https://example.org/feed.json","items": [.result.data.allNodeActualites.edges[] | {title: .node.title, url: .node.path.alias, content_html:.node.body.processed}]}'
|
||||
}
|
||||
|
||||
# https://learntutorials.net/fr/bash/topic/746/script-avec-des-parametres
|
||||
# Load the user defined parameters
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
case "$1" in
|
||||
|
||||
https://*.json|http://*.json)
|
||||
link="$1"
|
||||
;;
|
||||
|
||||
--help|*)
|
||||
echo "gatsbyfeed : URL manquante"
|
||||
echo "Usage : gatsbyfeed URL"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
to_feed "$link"
|
||||
Loading…
Add table
Add a link
Reference in a new issue