Skip to content

Commit

Permalink
add CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
beeequeue committed Feb 1, 2025
1 parent 6eb7e1f commit 17e1910
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/great-toes-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@beequeue/gmd": minor
---

Added a CLI
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ A library for parsing and serializing GMD files for the MT Framework engine, mor

Largely based on the work in [onepiecefreak3/GMDConverter](https://github.com/onepiecefreak3/GMDConverter).

## Usage (CLI)

```sh
pnpm install -g @beequeue/gmd
gmd --help
```

The input can be a file, directory, or glob pattern.

By default the output will be written to the same directory as the input file.

`--option` can be used to change this to a specific directory.

```sh
gmd decode --output ./output path/to/files/**/*.gmd
gmd encode ./output/**/*
```

## Usage

```typescript
Expand Down
4 changes: 3 additions & 1 deletion src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ if (isGlob(input) || checkIfDir(input)) {

let finish: APIBuilder<PathsOutput>
if (checkIfDir(input)) {
finish = builder.filter((file) => file.endsWith(".gmd")).crawl(input)
finish = builder
.filter((file) => file.endsWith(command === "decode" ? ".gmd" : ".gmd.json"))
.crawl(input)
} else {
const { base, glob } = pico.scan(input)
finish = builder.glob(glob).crawl(base)
Expand Down

0 comments on commit 17e1910

Please sign in to comment.