Skip to content

Commit

Permalink
Logging Depth / Space / Pipe Flags (merged)
Browse files Browse the repository at this point in the history
Merge branch 'main' into exp-pkg

Haven't actually looked into what merge commits are, or how they work. I think they are a bigger thing that could be very useful to me. It sounds like it sets a new starting point for the diffs of branches in terms of where future commits are based off of. I think this is absolutely very nice, and it's how I'd hoped it would work. With my limited insight into what merge commits were, I thought merging a branch meant that it was the end of that branch, and that no more work could be done on it. Thankfully, not!

https://stackoverflow.com/questions/57002121/how-to-merge-two-branchesmaster-and-demo-branch-code-in-git
https://www.biteinteractive.com/understanding-git-merge/

"My Philosophy of Discovery"

Listening to my projects in their full lossless form from my local file copies, rather than on Bandcamp through it's player, and they are definitely absolutely much better! I was kind of getting bummed it wasn't as clear as it seemed when I was making it. But the source files are plenty clear, and I'm still happy with how those sound. And "Cuatro de la Manana" seemed like it was missing something for not having a bass track when listening to it on Bandcamp, but it still sounds great when listening to the full-quality version. I think I didn't end up recording one for it because I didn't want to crowd the mix with the already bigger overdub overlap, and now I think again that it was the right decision for that song. I think my upcoming next goal is to properly finish the artwork for my other albums, so I can get them to YouTube, and also download all of the final copies for the songs, so I can properly add them to my own music library. I'm glad I went with the limited song list for "so, many, bad, decisions" as well, it really brings up the song strength of the album. I think this and "Flatlands" are probably my two best albums to date, I think. I'm really happy with how far things have come, and I only want to continue towards raising the bar on the quality of my work, and still continue trying new things. The next album has the hypothetical concept of being "jazzy death metal", but I don't want to force things out just to accomplish that. I want it to be however it happens.

Watched this the other day as well, a great one again! Always things to learn from the Hevy Devy podcasts. The things brought up always tend to be things similar to what I'm dealing with as well, and it comes at the perfect time to equate with my own scenarios.

https://www.youtube.com/watch?v=1SHtIbmzsBw

On the "jazzy death metal" part, I am also going to try starting to write my own lyrics for things, proper lyrics as well, since all of my other attempts at it thus far have mostly been off the cuff ones, and it gets a bit messy. That's all part of the fun, I really like doing that. It is a new avenue to write something full and complete going into it though, I think lyrics may be a nice way at helping work on that. I struggle with going through on completing a whole idea that I had at the start of a new concept. Usually it turns into something new by the time I'm done with it. That's okay as well, and that's probably what's going to happen with the lyrics to be honest haha.

"Rotten Swine Ligament"
  • Loading branch information
Offroaders123 committed Jan 19, 2024
2 parents 9a78421 + 66024f1 commit 83285c4
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 21 deletions.
56 changes: 52 additions & 4 deletions src/bin/args.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
const SNBT_PATTERN = /^--snbt$/;
import type { NBTDataOptions, StringifyOptions } from "../index.js";

const NBT_PATTERN = /^--nbt$/;
const SNBT_PATTERN = /^--snbt$/;
const ROOT_NAME_PATTERN = /^--root-name=/;
const ENDIAN_PATTERN = /^--endian=/;
const COMPRESSION_PATTERN = /^--compression=/;
const BEDROCK_LEVEL_PATTERN = /^--bedrock-level=/;
const SPACE_PATTERN = /^--space=/;

const args: string[] = process.argv.slice(2);

Expand All @@ -14,13 +21,54 @@ export const file: string = args.shift() ?? (() => {

for (const arg of args){
switch (true){
case SNBT_PATTERN.test(arg):
case NBT_PATTERN.test(arg):
case SNBT_PATTERN.test(arg):
case ROOT_NAME_PATTERN.test(arg):
case ENDIAN_PATTERN.test(arg):
case COMPRESSION_PATTERN.test(arg):
case BEDROCK_LEVEL_PATTERN.test(arg):
case SPACE_PATTERN.test(arg):
break;
default:
throw new TypeError(`Unexpected argument '${arg}'`);
}
}

export const snbt: boolean = args.some(arg => SNBT_PATTERN.test(arg));
export const nbt: boolean = args.some(arg => NBT_PATTERN.test(arg));
export const nbt: boolean = args
.some(arg => NBT_PATTERN.test(arg));

export const snbt: boolean = args
.some(arg => SNBT_PATTERN.test(arg));

type NonPartial<T> = { [K in keyof Required<T>]: T[K] };

type NonPartialFormat = NonPartial<NBTDataOptions>;

const rootName: NonPartialFormat["rootName"] = args
.find(arg => ROOT_NAME_PATTERN.test(arg))
?.replace(ROOT_NAME_PATTERN,"");

const endian: NonPartialFormat["endian"] = args
.find(arg => ENDIAN_PATTERN.test(arg))
?.replace(ENDIAN_PATTERN,"") as NonPartialFormat["endian"];

const compression: NonPartialFormat["compression"] = args
.find(arg => COMPRESSION_PATTERN.test(arg))
?.replace(COMPRESSION_PATTERN,"") as NonPartialFormat["compression"];

const bedrockLevel: NonPartialFormat["bedrockLevel"] = args
.find(arg => BEDROCK_LEVEL_PATTERN.test(arg))
?.replace(BEDROCK_LEVEL_PATTERN,"") as NonPartialFormat["bedrockLevel"];

export const format: NonPartialFormat = { rootName, endian, compression, bedrockLevel };

export const space: StringifyOptions["space"] = (() => {
const space: string | undefined = args
.find(arg => SPACE_PATTERN.test(arg))
?.replace(SPACE_PATTERN,"");
if (Number.isNaN(Number(space))){
return space;
} else {
return Number(space);
}
})();
39 changes: 22 additions & 17 deletions src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import { extname } from "node:path";
import { readFile } from "node:fs/promises";
import { inspect, promisify } from "node:util";
import { read, write, parse, stringify, NBTData } from "../index.js";
import { file, snbt, nbt } from "./args.js";
import { file, nbt, snbt, format, space } from "./args.js";

import type { Format, RootTag } from "../index.js";
import type { RootTag } from "../index.js";

(async () => {

Expand All @@ -14,21 +15,25 @@ if (file === undefined){
throw new TypeError("Missing argument 'input'");
}

const format: Format = {
rootName: "",
endian: "little",
compression: null,
bedrockLevel: null
};

const input = await readFile(file);
const data: RootTag | NBTData = extname(file) === ".snbt" ? parse(input.toString()) : await read(input,format);

if (!nbt){
console.log(snbt ? stringify(data,{ space: 2 }) : data);
} else {
const output: string | Uint8Array = snbt ? stringify(data,{ space: 2 }) : await write(data,format);
await new Promise<Error | undefined>(resolve => process.stdout.write(output,resolve));
const buffer: Buffer = await readFile(file);

const input: RootTag | NBTData = extname(file) === ".snbt"
? parse(buffer.toString())
: await read(buffer);

const output: NBTData = new NBTData(input,format);

if (!nbt && !snbt){
const result: string | NBTData = snbt
? stringify(output,{ space: 2 })
: output;
console.log(inspect(result,{ colors: true, depth: Infinity }));
process.exit(0);
}

const result: string | Uint8Array = snbt
? `${stringify(output,{ space: space ?? 2 })}\n`
: await write(output);
await promisify(process.stdout.write.bind(process.stdout))(result);

})();

0 comments on commit 83285c4

Please sign in to comment.