-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added CLI, refactor to seperate UI and logic slightly better
- Loading branch information
Showing
22 changed files
with
1,699 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist | ||
dist-api | ||
dist-web | ||
node_modules | ||
public/vanilla_datapacks | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env node | ||
|
||
import fs from 'fs'; | ||
import { BiomeBuilder, Exporter } from '../dist-api/snowcapped.mjs' | ||
import { program } from 'commander'; | ||
|
||
program | ||
.argument('<input>', 'Input snowcapped file') | ||
.option('-d, --dimension <file>', 'Ouput file for dimension file') | ||
.option('-c, --biome-colors <file>', 'Output file for biome-colors.json file') | ||
.usage('<input> [-d <dimension output>] [-c <biome_colors output>]') | ||
|
||
program.parse() | ||
|
||
const biomeBuilder = new BiomeBuilder() | ||
|
||
const inputJson = JSON.parse(fs.readFileSync(program.args[0], 'utf8')) | ||
biomeBuilder.loadJSON(inputJson) | ||
|
||
const exporter = new Exporter(biomeBuilder) | ||
|
||
const options = program.opts() | ||
|
||
console.log(options) | ||
|
||
if (options.dimension){ | ||
fs.writeFileSync(options.dimension, JSON.stringify(exporter.getDimensionJSON(), null, 2), {encoding: "utf8"}) | ||
} | ||
|
||
if (options.biomeColors){ | ||
if (!biomeBuilder.exportBiomeColors){ | ||
console.warn("Warning: Biome Color export is disabled by in Snowcapped settings. Exporing anyways.") | ||
} | ||
fs.writeFileSync(options.biomeColors, JSON.stringify(exporter.getBiomeColorJson(), null, 2)) | ||
} |
Oops, something went wrong.