Skip to content

Commit

Permalink
[update] fix incorrect cli params
Browse files Browse the repository at this point in the history
  • Loading branch information
yang-zhongtian committed Jun 2, 2024
1 parent 57ba672 commit 5b04f60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions cli/protect.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env node
#!/usr/bin/env node
const {Command} = require('commander');
const {readFileSync, writeFileSync} = require('fs');
const {protect} = require('@kprotect/compiler');
Expand All @@ -11,15 +11,15 @@ program
.option('-o, --output <file>', 'Output file path')
.parse(process.argv);

const {source, output} = program.opts();
const {input, output} = program.opts();

if (!source || !output) {
console.error('Error: Both source and output file paths are required.');
if (!input || !output) {
console.error('Error: Both input and output file paths are required.');
process.exit(1);
}

const cwd = process.cwd();
const absoluteSource = path.resolve(cwd, source);
const absoluteSource = path.resolve(cwd, input);
const absoluteOutput = path.resolve(cwd, output);

const src = readFileSync(absoluteSource).toString();
Expand All @@ -28,4 +28,4 @@ const {bytecode, strings} = protect(src);

embed(bytecode, strings).then(embedded => {
writeFileSync(absoluteOutput, embedded);
})
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build:debugger": "yarn workspace @kprotect/debugger build",
"protect": "node cli/protect.cjs",
"disassemble": "node cli/disassemble.cjs",
"test": "npm run protect -- -s protect/src.js -o protect/bundle.js",
"test": "npm run protect -- -i protect/src.js -o protect/bundle.js",
"unit": "yarn workspace @kprotect/test test"
},
"author": "Richard Yang",
Expand Down

0 comments on commit 5b04f60

Please sign in to comment.