kopia lustrzana https://github.com/robinmoisson/staticrypt
Made final argument parsing changes.
rodzic
3817b679fe
commit
aae55d592b
35
cli/index.js
35
cli/index.js
|
@ -10,13 +10,32 @@ const SCRIPT_URL = 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/cry
|
||||||
const SCRIPT_TAG = '<script src="' + SCRIPT_URL + '" integrity="sha384-lp4k1VRKPU9eBnPePjnJ9M2RF3i7PC30gXs70+elCVfgwLwx1tv5+ctxdtwxqZa7" crossorigin="anonymous"></script>';
|
const SCRIPT_TAG = '<script src="' + SCRIPT_URL + '" integrity="sha384-lp4k1VRKPU9eBnPePjnJ9M2RF3i7PC30gXs70+elCVfgwLwx1tv5+ctxdtwxqZa7" crossorigin="anonymous"></script>';
|
||||||
|
|
||||||
const namedArgs = Yargs
|
const namedArgs = Yargs
|
||||||
.usage('staticrypt <input> <password> options')
|
.usage('Usage: staticrypt <input> <password> [options]')
|
||||||
.demandCommand(2)
|
.demandCommand(2)
|
||||||
.default({'output': null, 'title': null, 'instructions': null, 'embed': null})
|
.option('e', {
|
||||||
.alias('o', 'output')
|
alias: 'embed',
|
||||||
.alias('t', 'title')
|
type: 'boolean',
|
||||||
.alias('i', 'instructions')
|
describe: 'Whether or not to embed crypto-js in the page (or use an external CDN)',
|
||||||
.alias('e', 'embed')
|
default: false
|
||||||
|
})
|
||||||
|
.option('o', {
|
||||||
|
alias: 'output',
|
||||||
|
type: 'string',
|
||||||
|
describe: 'File name / path for generated encrypted file',
|
||||||
|
default: null
|
||||||
|
})
|
||||||
|
.option('t', {
|
||||||
|
alias: 'title',
|
||||||
|
type: 'string',
|
||||||
|
describe: "Title for output HTML page",
|
||||||
|
default: 'Protected Page'
|
||||||
|
})
|
||||||
|
.option('i', {
|
||||||
|
alias: 'instructions',
|
||||||
|
type: 'string',
|
||||||
|
describe: 'Special instructions to display to the user.',
|
||||||
|
default: null
|
||||||
|
})
|
||||||
.argv;
|
.argv;
|
||||||
|
|
||||||
if(namedArgs._.length != 2){
|
if(namedArgs._.length != 2){
|
||||||
|
@ -24,8 +43,8 @@ if(namedArgs._.length != 2){
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const input = namedArgs._[0];
|
const input = namedArgs._[0].toString();
|
||||||
const password = namedArgs._[1];
|
const password = namedArgs._[1].toString();
|
||||||
|
|
||||||
try{
|
try{
|
||||||
var contents = FileSystem.readFileSync(input, 'utf8');
|
var contents = FileSystem.readFileSync(input, 'utf8');
|
||||||
|
|
Ładowanie…
Reference in New Issue