Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix all keyword 'interface' naming clashes #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hostapd.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ var hostapd = module.exports = {
* });
*
*/
function disable(interface, callback) {
var file = interface + '-hostapd.conf';
function disable(interface_, callback) {
var file = interface_ + '-hostapd.conf';

return this.exec('kill `pgrep -f "^hostapd -B ' + file + '"` || true',
callback);
Expand Down
10 changes: 5 additions & 5 deletions ifconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ function parse_status_interface(callback) {
* ]
*
*/
function status(interface, callback) {
function status(interface_, callback) {
if (callback) {
this.exec('ifconfig ' + interface, parse_status_interface(callback));
this.exec('ifconfig ' + interface_, parse_status_interface(callback));
}
else {
this.exec('ifconfig -a', parse_status(interface));
this.exec('ifconfig -a', parse_status(interface_));
}
}

Expand All @@ -213,8 +213,8 @@ function status(interface, callback) {
* });
*
*/
function down(interface, callback) {
return this.exec('ifconfig ' + interface + ' down', callback);
function down(interface_, callback) {
return this.exec('ifconfig ' + interface_ + ' down', callback);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions iw.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ function parse_scan(show_hidden, callback) {
* @param {function} callback The callback function.
*/
function scan(options, callback) {
var interface, show_hidden
var interface_, show_hidden
if (typeof options === 'string') {
var interface = options;
var interface_ = options;
var show_hidden = false;
} else {
var interface = options.iface;
var interface_ = options.iface;
var show_hidden = options.show_hidden || false;
}

this.exec('iw dev ' + interface + ' scan', parse_scan(show_hidden, callback));
this.exec('iw dev ' + interface_ + ' scan', parse_scan(show_hidden, callback));
}
6 changes: 3 additions & 3 deletions iwconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ function parse_status_interface(callback) {
* ]
*
*/
function status(interface, callback) {
function status(interface_, callback) {
if (callback) {
return this.exec('iwconfig ' + interface,
return this.exec('iwconfig ' + interface_,
parse_status_interface(callback));
}
else {
return this.exec('iwconfig', parse_status(interface));
return this.exec('iwconfig', parse_status(interface_));
}
}
8 changes: 4 additions & 4 deletions iwlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,12 @@ function parse_scan(show_hidden, callback) {
*
*/
function scan(options, callback) {
var interface, show_hidden
var interface_, show_hidden
if (typeof options === 'string') {
var interface = options;
var interface_ = options;
var show_hidden = false;
} else {
var interface = options.iface;
var interface_ = options.iface;
var show_hidden = options.show_hidden || false;
}

Expand All @@ -306,5 +306,5 @@ function scan(options, callback) {
extra_params = ' essid ' + options.ssid;
}

this.exec('iwlist ' + interface + ' scan' + extra_params, parse_scan(show_hidden, callback));
this.exec('iwlist ' + interface_ + ' scan' + extra_params, parse_scan(show_hidden, callback));
}
89 changes: 58 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,56 @@
{
"name": "wireless-tools",
"version": "0.19.0",
"_from": "wireless-tools@^0.19.0",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha1-Z/tzzTcfLZujue8lNACjH4x4SxE=",
"_location": "/wireless-tools",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "wireless-tools@^0.19.0",
"name": "wireless-tools",
"escapedName": "wireless-tools",
"rawSpec": "^0.19.0",
"saveSpec": null,
"fetchSpec": "^0.19.0"
},
"_requiredBy": [
"/pi-wifi"
],
"_resolved": "https://registry.npmjs.org/wireless-tools/-/wireless-tools-0.19.0.tgz",
"_shasum": "67fb73cd371f2d9ba3b9ef253400a31f8c784b11",
"_spec": "wireless-tools@^0.19.0",
"_where": "/home/pi/pdac/pdac-frontend/node_modules/pi-wifi",
"author": {
"name": "Christopher M. Baker"
},
"bugs": {
"url": "https://github.com/bakerface/wireless-tools/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Athom",
"email": "[email protected]",
"url": "https://www.athom.com/en/"
},
{
"name": "Wink",
"email": "[email protected]",
"url": "https://www.wink.com/"
}
],
"deprecated": false,
"description": "Wireless tools for Node.js",
"author": "Christopher M. Baker",
"license": "MIT",
"devDependencies": {
"codeclimate-test-reporter": "^0.3.1",
"istanbul": "^0.4.3",
"mocha": "^2.5.3",
"should": "^9.0.2",
"xo": "^0.16.0"
},
"homepage": "https://github.com/bakerface/wireless-tools",
"main": "wireless-tools.js",
"keywords": [
"wireless",
"tools",
Expand All @@ -18,38 +63,20 @@
"udhcpd",
"wpa_supplicant"
],
"license": "MIT",
"main": "wireless-tools.js",
"name": "wireless-tools",
"repository": {
"type": "git",
"url": "https://github.com/bakerface/wireless-tools.git"
},
"bugs": {
"url": "https://github.com/bakerface/wireless-tools/issues"
"url": "git+https://github.com/bakerface/wireless-tools.git"
},
"scripts": {
"test": "istanbul cover node_modules/.bin/_mocha",
"codeclimate": "codeclimate-test-reporter < coverage/lcov.info",
"posttest": "istanbul check-coverage --statements 100 --functions 100 --branches 100 --lines 100",
"codeclimate": "codeclimate-test-reporter < coverage/lcov.info"
"test": "istanbul cover node_modules/.bin/_mocha"
},
"version": "0.19.0",
"xo": {
"space": true
},
"devDependencies": {
"codeclimate-test-reporter": "^0.3.1",
"istanbul": "^0.4.3",
"mocha": "^2.5.3",
"should": "^9.0.2",
"xo": "^0.16.0"
},
"contributors": [
{
"name": "Athom",
"email": "[email protected]",
"url": "https://www.athom.com/en/"
},
{
"name": "Wink",
"email": "[email protected]",
"url": "https://www.wink.com/"
}
]
}
}
4 changes: 2 additions & 2 deletions udhcpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ var udhcpc = module.exports = {
* });
*
*/
function disable(interface, callback) {
var command = 'kill `pgrep -f "^udhcpc -i ' + interface + '"` || true';
function disable(interface_, callback) {
var command = 'kill `pgrep -f "^udhcpc -i ' + interface_ + '"` || true';
return this.exec(command, callback);
}

Expand Down
4 changes: 2 additions & 2 deletions udhcpd.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function enable(options, callback) {
* });
*
*/
function disable(interface, callback) {
var file = interface + '-udhcpd.conf';
function disable(interface_, callback) {
var file = interface_ + '-udhcpd.conf';
return this.exec('kill `pgrep -f "^udhcpd ' + file + '"` || true', callback);
}
52 changes: 26 additions & 26 deletions wpa_cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,19 +297,19 @@ function parse_scan_results_interface(callback) {
* OK
*
*/
function status(interface, callback) {
var command = [ 'wpa_cli -i', interface, 'status'].join(' ');
function status(interface_, callback) {
var command = [ 'wpa_cli -i', interface_, 'status'].join(' ');
return this.exec(command, parse_status_interface(callback));
}

function bssid(interface, ap, ssid, callback) {
var command = ['wpa_cli -i', interface, 'bssid', ssid, ap].join(' ');
function bssid(interface_, ap, ssid, callback) {
var command = ['wpa_cli -i', interface_, 'bssid', ssid, ap].join(' ');
return this.exec(command, parse_command_interface(callback));
}

function reassociate(interface, callback) {
function reassociate(interface_, callback) {
var command = ['wpa_cli -i',
interface,
interface_,
'reassociate'].join(' ');

return this.exec(command, parse_command_interface(callback));
Expand All @@ -326,27 +326,27 @@ function reassociate(interface, callback) {
// enable_network: enable_network
*/

function set(interface, variable, value, callback) {
function set(interface_, variable, value, callback) {
var command = ['wpa_cli -i',
interface,
interface_,
'set',
variable,
value ].join(' ');

return this.exec(command, parse_command_interface(callback));
}

function add_network(interface, callback) {
function add_network(interface_, callback) {
var command = ['wpa_cli -i',
interface,
interface_,
'add_network' ].join(' ');

return this.exec(command, parse_command_interface(callback));
}

function set_network(interface, id, variable, value, callback) {
function set_network(interface_, id, variable, value, callback) {
var command = ['wpa_cli -i',
interface,
interface_,
'set_network',
id,
variable,
Expand All @@ -355,61 +355,61 @@ function set_network(interface, id, variable, value, callback) {
return this.exec(command, parse_command_interface(callback));
}

function enable_network(interface, id, callback) {
function enable_network(interface_, id, callback) {
var command = ['wpa_cli -i',
interface,
interface_,
'enable_network',
id ].join(' ');

return this.exec(command, parse_command_interface(callback));
}

function disable_network(interface, id, callback) {
function disable_network(interface_, id, callback) {
var command = ['wpa_cli -i',
interface,
interface_,
'disable_network',
id ].join(' ');

return this.exec(command, parse_command_interface(callback));
}

function remove_network(interface, id, callback) {
function remove_network(interface_, id, callback) {
var command = ['wpa_cli -i',
interface,
interface_,
'remove_network',
id ].join(' ');

return this.exec(command, parse_command_interface(callback));
}

function select_network(interface, id, callback) {
function select_network(interface_, id, callback) {
var command = ['wpa_cli -i',
interface,
interface_,
'select_network',
id ].join(' ');

return this.exec(command, parse_command_interface(callback));
}

function scan(interface, callback) {
function scan(interface_, callback) {
var command = ['wpa_cli -i',
interface,
interface_,
'scan'].join(' ');

return this.exec(command, parse_command_interface(callback));
}

function scan_results(interface, callback) {
function scan_results(interface_, callback) {
var command = ['wpa_cli -i',
interface,
interface_,
'scan_results'].join(' ');

return this.exec(command, parse_scan_results_interface(callback));
}

function save_config(interface, callback) {
function save_config(interface_, callback) {
var command = ['wpa_cli -i',
interface,
interface_,
'save_config'].join(' ');

return this.exec(command, parse_command_interface(callback));
Expand Down
4 changes: 2 additions & 2 deletions wpa_supplicant.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ var wpa_supplicant = module.exports = {
* });
*
*/
function disable(interface, callback) {
function disable(interface_, callback) {
var command = 'kill `pgrep -f "wpa_supplicant -i ' +
interface + ' .*"` || true';
interface_ + ' .*"` || true';

return this.exec(command, callback);
}
Expand Down