mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-03 15:20:06 -05:00
fixed console command arg parsing on recovery core
This commit is contained in:
parent
564d789e35
commit
2faede16d4
@ -103,6 +103,8 @@ function pathjoin()
|
|||||||
if (x.length == 0) return '/';
|
if (x.length == 0) return '/';
|
||||||
return x.join('/');
|
return x.join('/');
|
||||||
}
|
}
|
||||||
|
// Replace a string with a number if the string is an exact number
|
||||||
|
function toNumberIfNumber(x) { if ((typeof x == 'string') && (+parseInt(x) === x)) { x = parseInt(x); } return x; }
|
||||||
|
|
||||||
|
|
||||||
function bsd_execv(name, agentfilename, sessionid)
|
function bsd_execv(name, agentfilename, sessionid)
|
||||||
@ -381,20 +383,25 @@ function splitArgs(str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse arguments string array into an object
|
// Parse arguments string array into an object
|
||||||
function parseArgs(argv) {
|
function parseArgs(argv)
|
||||||
|
{
|
||||||
var results = { '_': [] }, current = null;
|
var results = { '_': [] }, current = null;
|
||||||
for (var i = 1, len = argv.length; i < len; i++) {
|
for (var i = 1, len = argv.length; i < len; i++)
|
||||||
|
{
|
||||||
var x = argv[i];
|
var x = argv[i];
|
||||||
if (x.length > 2 && x[0] == '-' && x[1] == '-') {
|
if (x.length > 2 && x[0] == '-' && x[1] == '-')
|
||||||
|
{
|
||||||
if (current != null) { results[current] = true; }
|
if (current != null) { results[current] = true; }
|
||||||
current = x.substring(2);
|
current = x.substring(2);
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
if (current != null) { results[current] = toNumberIfNumber(x); current = null; } else { results['_'].push(toNumberIfNumber(x)); }
|
if (current != null) { results[current] = toNumberIfNumber(x); current = null; } else { results['_'].push(toNumberIfNumber(x)); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (current != null) { results[current] = true; }
|
if (current != null) { results[current] = true; }
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get server target url with a custom path
|
// Get server target url with a custom path
|
||||||
function getServerTargetUrl(path) {
|
function getServerTargetUrl(path) {
|
||||||
var x = require('MeshAgent').ServerUrl;
|
var x = require('MeshAgent').ServerUrl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user