From c0f4b3c9794455f7935a3ebfb6110c5b8a7492cb Mon Sep 17 00:00:00 2001 From: cedric Date: Thu, 20 Jun 2024 16:59:09 +0200 Subject: [PATCH] Initial commit --- gatsbyfeed | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 gatsbyfeed diff --git a/gatsbyfeed b/gatsbyfeed new file mode 100644 index 0000000..0156ee2 --- /dev/null +++ b/gatsbyfeed @@ -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" \ No newline at end of file