File tree Expand file tree Collapse file tree 5 files changed +17
-23
lines changed
Expand file tree Collapse file tree 5 files changed +17
-23
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## 1.0.5
4+ * 2021-02-09*
5+ - Added flag aliases ` h ` and ` v ` for ` --help ` and ` --version ` respectively.
6+ - Fixed a crash occurring when retrieving a pack format via the command-line.
7+
38## 1.0.4
49* 2021-02-09*
510- Fixed command-line usage not working.
Original file line number Diff line number Diff line change 1- #!usr/bin/env node
2- const VERSION = '1.0.4 '
1+ #!/ usr/bin/env node
2+ const VERSION = '1.0.5 '
33
44const getPackFormat = require ( './index.js' )
55
6- function cli ( ) {
6+ const arg = n => process . argv [ n + 1 ]
77
8- const arg = n => process . argv [ n + 1 ]
9-
10- if ( arg ( 1 ) && ! arg ( 1 ) . includes ( '-h' ) )
11- if ( arg ( 1 ) . includes ( '-v' ) )
12- console . log ( `The current version of pack-format is ${ VERSION } ` )
13- else
14- console . log ( `Pack format of ${ arg ( 1 ) } is ${ getPackFormat ( arg ( 1 ) ) } ` )
8+ if ( arg ( 1 ) && ! arg ( 1 ) . includes ( 'h' ) )
9+ if ( arg ( 1 ) . includes ( 'v' ) )
10+ console . log ( `The current version of pack-format is ${ VERSION } ` )
1511 else
16- console . log ( 'Type `pack-format <version>` to retrieve the pack format of any Minecraft version.' )
17-
18- }
12+ console . log ( `Pack format of ${ arg ( 1 ) } is ${ getPackFormat ( arg ( 1 ) ) } ` )
13+ else
14+ console . log ( 'Type `pack-format <version>` to retrieve the pack format of any Minecraft version.' )
1915
20- module . exports = cli
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3- const cli = require ( './cli.js' )
4-
53class Snapshot {
64 constructor ( version ) { this . version = version }
75 getYear ( ) { return parseInt ( this . version . replace ( / ^ ( \d \d ) .+ $ / , '$1' ) ) }
@@ -63,8 +61,4 @@ function getPackFormat(version) {
6361 }
6462}
6563
66- if ( require . main === module ) {
67- cli ( )
68- }
69-
7064module . exports = getPackFormat
Original file line number Diff line number Diff line change 11{
22 "name" : " pack-format" ,
3- "version" : " 1.0.4 " ,
3+ "version" : " 1.0.5 " ,
44 "description" : " Returns the pack_format of any Minecraft version, including snapshots" ,
55 "scripts" : {
66 "test" : " node test"
1313 ],
1414 "main" : " index.js" ,
1515 "bin" : {
16- "pack-format" : " index .js"
16+ "pack-format" : " cli .js"
1717 },
1818 "repository" : {
1919 "type" : " git" ,
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ packFormat('1.16.2-pre1') // 5
2929
3030` pack-format <version> `
3131
32- ``` cmd
32+ ``` sh
3333> pack-format 1.14.4
3434Pack format of 1.14.4 is 4
3535> pack-format 1.16.2-pre1
You can’t perform that action at this time.
0 commit comments