-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add help command - Split CLI usage into separate file - Refactor tests
- Loading branch information
Showing
6 changed files
with
52 additions
and
25 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!usr/bin/env node | ||
const VERSION = '1.0.3' | ||
|
||
const getPackFormat = require('./index.js') | ||
|
||
const arg = n => process.argv[n + 1] | ||
|
||
if (arg(1) && !arg(1).includes('-h')) | ||
if (arg(1).includes('-v')) | ||
console.log(`The current version of pack-format is ${VERSION}`) | ||
else | ||
console.log(`Pack format of ${arg(1)} is ${getPackFormat(arg(1))}`) | ||
else | ||
console.log('Type `pack-format <version>` to retrieve the pack format of any Minecraft version.') |
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
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,30 +1,37 @@ | ||
[![Latest version](https://img.shields.io/github/v/release/Nixinova/pack-format?label=latest&style=flat-square)](https://github.com/Nixinova/pack-format/releases) | ||
[![npm downloads](https://img.shields.io/npm/dt/pack-format?style=flat-square)](https://www.npmjs.com/package/pack-format) | ||
[![Last updated](https://img.shields.io/github/release-date-pre/Nixinova/pack-format?label=updated&style=flat-square)](https://github.com/Nixinova/pack-format/releases) | ||
|
||
# pack-format | ||
|
||
pack-format is a Node.js tool for retrieving the `pack_format` of any Minecraft version, including snapshots. | ||
|
||
## About | ||
|
||
`pack_format` is a version number used in both resource packs and data packs for labeling compatible versions. | ||
It was added in version 1.6, and as such using this tool on any version prior to that will just return `undefined`. | ||
It was added in Minecraft version 1.6, and as such using this tool on any version prior to that will just return `undefined`. | ||
|
||
## Install | ||
|
||
Using npm, type `npm install pack-format` to use for a Node.js project, or `npm install -g pack-format` to use from the command line. | ||
Using npm, open your command prompt and type `npm install pack-format` to use for a Node.js project or `npm install -g pack-format` to use from the command line. | ||
|
||
## Usage | ||
|
||
### Node | ||
|
||
```js | ||
const getPackFormat = require('pack-format') | ||
console.log( getPackFormat('1.14.3') ) // 4 | ||
console.log( getPackFormat('1.16.2-pre1') ) // 5 | ||
console.log( getPackFormat('15w42a') ) // 2 | ||
console.log( getPackFormat('1.4.7') ) // undefined | ||
const packFormat = require('pack-format') | ||
packFormat('1.14.4') // 4 | ||
packFormat('1.16.2-pre1') // 5 | ||
``` | ||
|
||
### Command line | ||
|
||
``` | ||
pack-format <version> | ||
`pack-format <version>` | ||
|
||
```cmd | ||
> pack-format 1.14.4 | ||
Pack format of 1.14.4 is 4 | ||
> pack-format 1.16.2-pre1 | ||
Pack format of 1.16.2-pre1 is 5 | ||
``` |
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