-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlocal.sh
55 lines (48 loc) · 1.23 KB
/
local.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
cd "$( dirname "$( realpath "$0" )" )"
[ "$1" = "update" ] && \
Message="$( [ -n "$2" ] && echo "$2" || cat .CommitMessage.txt )" && \
git add . && git commit -m ": ${Message}" && git push
slug="$2"
date="$([ -n "$4" ] && echo "$4" || date "+%Y-%m-%d")"
mobyid="$3"
[ "$1" = "newpost" ] && ([ -n "${slug}" ] && (\
mkdir -p "./assets/media/games/${slug}" && \
echo "Add ${slug} [${date}]" > .CommitMessage.txt && \
cat << [EOF] > "./_posts/${date}-${slug}.md"
---
layout: "post"
title: "$([ -n "${mobyid}" ] && curl --fail --location "https://www.mobygames.com/game/${mobyid}/" | grep '<meta property="og:title"' | cut -b36-)"
subtitle: ""
description: ""
image: "/assets/media/games/${slug}/"
image_source: "internal"
icon: "../../../../assets/media/games/${slug}/"
category: "games"
tags:
- ""
author: "octobot"
mobygames_id: "${mobyid}"
software_data:
backend: ""
platform: ""
core: ""
rom_index: ""
frame_url: ""
frame_index: ""
release:
authors: ""
region: ""
source: ""
type: ""
year: ""
screen:
orientation: ""
display: ""
---
## About the game
<!-- [...] -->
## Resources
* Official page of the game; Cover image credits: <>
[EOF]
) || echo "Usage: $1 <slug> [mobygames id] [date]")