58ca4e68db
- Go backend API with full CRUD for all modules (CRM, Sales, Finance, HR, Legal, Marketing, Support, Purchase, Inventory, Projects, Automation, Analytics) - Rust analytics service with parallel report generation - C runtime with POSIX shared memory IPC - PostgreSQL schema with 30+ tables, full migrations - Redis cache, sessions, pub/sub - Kafka event streaming with Zookeeper - WebSocket hub for real-time updates - Automation engine with cron jobs, workflows, event triggers - JWT authentication, multi-tenant from start - Docker Compose with all services - Nginx reverse proxy with rate limiting - Integration tests passing - Feature gap analysis against Fortnox/Odoo/Visma Refs: BOC-001
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
var parse = require('./parse');
|
|
|
|
/**
|
|
* Converts a string to command line args, in particular
|
|
* groups together quoted values.
|
|
* This is a utility function to allow calling nodemon as a required
|
|
* library, but with the CLI args passed in (instead of an object).
|
|
*
|
|
* @param {String} string
|
|
* @return {Array}
|
|
*/
|
|
function stringToArgs(string) {
|
|
var args = [];
|
|
|
|
var parts = string.split(' ');
|
|
var length = parts.length;
|
|
var i = 0;
|
|
var open = false;
|
|
var grouped = '';
|
|
var lead = '';
|
|
|
|
for (; i < length; i++) {
|
|
lead = parts[i].substring(0, 1);
|
|
if (lead === '"' || lead === '\'') {
|
|
open = lead;
|
|
grouped = parts[i].substring(1);
|
|
} else if (open && parts[i].slice(-1) === open) {
|
|
open = false;
|
|
grouped += ' ' + parts[i].slice(0, -1);
|
|
args.push(grouped);
|
|
} else if (open) {
|
|
grouped += ' ' + parts[i];
|
|
} else {
|
|
args.push(parts[i]);
|
|
}
|
|
}
|
|
|
|
return args;
|
|
}
|
|
|
|
module.exports = {
|
|
parse: function (argv) {
|
|
if (typeof argv === 'string') {
|
|
argv = stringToArgs(argv);
|
|
}
|
|
|
|
return parse(argv);
|
|
},
|
|
}; |