mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-13 03:50:02 -04:00
New shutdown script for cross-platform ease of use; implement host option in config file; minor code cleanup.
This commit is contained in:
parent
c21d775ee8
commit
92909e4ab7
7 changed files with 59 additions and 10 deletions
|
@ -1,7 +1,13 @@
|
|||
import { readFile } from 'node:fs/promises';
|
||||
|
||||
// Parse the config file to grab a property value from it.
|
||||
let property = JSON.parse(await readFile(new URL("./src/config.json", import.meta.url)));
|
||||
// Combine all descriptors (from command line arguments) to get the property value.
|
||||
process.argv.slice(2).forEach(descriptor => {property = property[descriptor]});
|
||||
|
||||
// Return a boolean if it's true or false.
|
||||
if (typeof property === "boolean") process.exitCode = +!property;
|
||||
// Otherwise, return a stringified version to the stream.
|
||||
else {
|
||||
console.log(property);
|
||||
process.exitCode = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue