@hyperionbt/helios-cli
Advanced tools
Comparing version 0.1.1 to 0.1.2
53
index.js
@@ -13,3 +13,3 @@ #!/usr/bin/env node | ||
const VERSION = "0.1.1"; | ||
const VERSION = "0.1.2"; | ||
@@ -28,2 +28,5 @@ const USAGE = `Usage: | ||
eval <input-file> <param-name> | ||
-I, --include <include-module-dir> | ||
version | ||
@@ -237,3 +240,3 @@ `; | ||
if (options.output !== undefined) { | ||
if (options.output != null) { | ||
fs.writeFileSync(options.output, uplc); | ||
@@ -245,2 +248,45 @@ } else { | ||
function parseEvalParamOptions(args) { | ||
const options = { | ||
includeDirs: parseOption(args, "-I", "--include", true) | ||
}; | ||
assertNoMoreOptions(args); | ||
return options; | ||
} | ||
async function evalParam(args) { | ||
const options = parseEvalParamOptions(args); | ||
const inputFile = args.shift(); | ||
if (inputFile === undefined) { | ||
throw new UsageError("no input-file specified") | ||
} | ||
const paramName = args.shift(); | ||
if (paramName === undefined) { | ||
throw new UsageError("no param-name specified"); | ||
} | ||
assertEmpty(args); | ||
const includeDirs = options.includeDirs.slice(); | ||
includeDirs.unshift("."); | ||
PATHS = listIncludes(inputFile, includeDirs); | ||
const sources = PATHS.map(p => readFile(p)); | ||
const inputSource = sources.shift(); | ||
const program = Program.new(inputSource, sources); | ||
const json = program.evalParam(paramName).data.toSchemaJson(); | ||
console.log(json); | ||
} | ||
function printVersion() { | ||
@@ -274,2 +320,5 @@ console.log(`Helios-CLI version: ${VERSION}`); | ||
break; | ||
case "eval": | ||
await evalParam(args); | ||
break; | ||
case "version": | ||
@@ -276,0 +325,0 @@ printVersion(); |
{ | ||
"name": "@hyperionbt/helios-cli", | ||
"type": "module", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "CLI tool for compiling Cardano smart contracts written in Helios, and building Cardano transactions.", | ||
@@ -6,0 +6,0 @@ "main": "./index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8213
267