29 lines
No EOL
767 B
Bash
29 lines
No EOL
767 B
Bash
#!/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" |