Skip to content

Commit

Permalink
Update PhTool.js
Browse files Browse the repository at this point in the history
Change `--host` parameter to `--hostname` and don't accept a port, see ebaauw/homebridge-hue#1196.
  • Loading branch information
ebaauw committed Nov 25, 2024
1 parent 8238d78 commit f9efb1e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/PhTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,7 @@ class PhTool extends CommandLineTool {
parser
.help('h', 'help', help.ph)
.version('V', 'version')
.option('H', 'host', (value) => {
OptionParser.toHost('host', value, false, true)
.option('H', 'hostname', (value) => {
clargs.options.host = value
})
.flag('D', 'debug', () => {
Expand Down Expand Up @@ -440,6 +439,10 @@ class PhTool extends CommandLineTool {
.remaining((list) => { clargs.args = list })
parser
.parse()
const { port } = OptionParser.toHost('hostname', clargs.options.host, false, true)
if (port != null) {
throw new UsageError(`hostname: ${clargs.options.host}: not a valid hostname or IPv4 address`)
}
return clargs
}

Expand Down

0 comments on commit f9efb1e

Please sign in to comment.