From f0d37be1bb1bee276aa8399a8fa4cba058789f64 Mon Sep 17 00:00:00 2001 From: YourFriendlyNeighborhoodDealer <qminer@2girls1dj.com> Date: Mon, 25 Feb 2019 09:27:57 +0100 Subject: [PATCH] motd.js for changing the motd easily --- motd.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 motd.js diff --git a/motd.js b/motd.js new file mode 100755 index 0000000..fcde954 --- /dev/null +++ b/motd.js @@ -0,0 +1,18 @@ +const utils = require('./utils.js'); +const dataFile = "public/data.json"; + +if (GetParams().length <= 0) { + console.log("no params!"); + process.exit(0); +} + +var param = GetParams().join(" "); +var d = utils.ReadFile(dataFile); +var parsed = JSON.parse(d); +console.log(param); +parsed.motd = param; +utils.WriteFile(JSON.stringify(parsed), dataFile); + +function GetParams() { + return process.argv.splice(2); +}