HEX
Server: Apache/2.4.63 (Unix)
System: Linux TOMS-220NAS 4.4.302+ #86009 SMP Wed Nov 26 18:19:17 CST 2025 x86_64
User: flavio87 (1026)
PHP: 8.3.27
Disabled: NONE
Upload Files
File: //var/packages/SynologyApplicationService/target/node_modules/repeating/cli.js
#!/usr/bin/env node
'use strict';
var pkg = require('./package.json');
var repeating = require('./');
var argv = process.argv.slice(2);

function help() {
	console.log([
		'',
		'  ' + pkg.description,
		'',
		'  Usage',
		'    $ repeating <string> <count>',
		'',
		'  Example',
		'    $ repeating \'unicorn \' 2',
		'    unicorn unicorn'
	].join('\n'));
}

if (process.argv.indexOf('--help') !== -1) {
	help();
	return;
}

if (process.argv.indexOf('--version') !== -1) {
	console.log(pkg.version);
	return;
}

if (!argv[1]) {
	console.error('You have to define how many times to repeat the string.');
	process.exit(1);
}

console.log(repeating(argv[0], Number(argv[1])));