Skip to content

Commit

Permalink
chore: move cli to bin directory (#1096)
Browse files Browse the repository at this point in the history
  • Loading branch information
OmgImAlexis authored May 11, 2020
1 parent 5978350 commit e3ea11a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
24 changes: 24 additions & 0 deletions bin/mqtt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env node
'use strict'

/*
* Copyright (c) 2015-2015 MQTT.js contributors.
* Copyright (c) 2011-2014 Adam Rudd.
*
* See LICENSE for more information
*/

var commist = require('commist')()
var helpMe = require('help-me')()

commist.register('publish', require('./bin/pub'))
commist.register('subscribe', require('./bin/sub'))
commist.register('version', function () {
console.log('MQTT.js version:', require('./package.json').version)
})
commist.register('help', helpMe.toStdout)

if (commist.parse(process.argv.slice(2)) !== null) {
console.log('No such command:', process.argv[2], '\n')
helpMe.toStdout()
}
24 changes: 0 additions & 24 deletions mqtt.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env node
'use strict'

/*
* Copyright (c) 2015-2015 MQTT.js contributors.
* Copyright (c) 2011-2014 Adam Rudd.
Expand All @@ -18,24 +15,3 @@ module.exports.connect = connect
module.exports.MqttClient = MqttClient
module.exports.Client = MqttClient
module.exports.Store = Store

function cli () {
var commist = require('commist')()
var helpMe = require('help-me')()

commist.register('publish', require('./bin/pub'))
commist.register('subscribe', require('./bin/sub'))
commist.register('version', function () {
console.log('MQTT.js version:', require('./package.json').version)
})
commist.register('help', helpMe.toStdout)

if (commist.parse(process.argv.slice(2)) !== null) {
console.log('No such command:', process.argv[2], '\n')
helpMe.toStdout()
}
}

if (require.main === module) {
cli()
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"bin": {
"mqtt_pub": "./bin/pub.js",
"mqtt_sub": "./bin/sub.js",
"mqtt": "./mqtt.js"
"mqtt": "./bin/mqtt.js"
},
"files": [
"dist/",
Expand Down

0 comments on commit e3ea11a

Please sign in to comment.