Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bin/jsonld.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ function _jsonLdOptions(command, input) {
options.safe = true;
}

if(command.context) {
options.expandContext = command.context;
}

options.base = _getBase(command, input);

// setup documentLoader
Expand Down Expand Up @@ -253,6 +257,7 @@ program

_jsonLdCommand(program.command('format [filename|URL|-]'))
.description('format and convert JSON-LD')
.option('-c, --context <filename|URL>', 'context filename or URL')
.option('-f, --format <format>', 'output format [json]', String)
.option('-q, --n-quads', 'output application/n-quads [false]')
.option('-j, --json', 'output application/json [true]')
Expand Down Expand Up @@ -297,6 +302,7 @@ _jsonLdCommand(program.command('format [filename|URL|-]'))

_jsonLdCommand(program.command('lint [filename|URL|-]'))
.description('lint JSON-LD')
.option('-c, --context <filename|URL>', 'context filename or URL')
.action(async function lint(input, cmd) {
input = input || '-';
const options = _jsonLdOptions(cmd, input);
Expand Down Expand Up @@ -329,6 +335,7 @@ _jsonLdCommand(program.command('compact [filename|URL]'))

_jsonLdCommand(program.command('expand [filename|URL|-]'))
.description('expand JSON-LD')
.option('-c, --context <filename|URL>', 'context filename or URL')
.option(' --keep-free-floating-nodes', 'keep free-floating nodes')
.action(async function expand(input, cmd) {
input = input || '-';
Expand Down