Skip to content

Commit

Permalink
Fix for -i command bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mbloch committed Jul 27, 2023
1 parent 1e9232d commit a83f8ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cli/mapshaper-run-command.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import '../commands/mapshaper-subdivide';
function commandAcceptsMultipleTargetDatasets(name) {
return name == 'rotate' || name == 'info' || name == 'proj' ||
name == 'drop' || name == 'target' || name == 'if' || name == 'elif' ||
name == 'else' || name == 'endif' || name == 'run';
name == 'else' || name == 'endif' || name == 'run' || name == 'i';
}

function commandAcceptsEmptyTarget(name) {
Expand Down
9 changes: 9 additions & 0 deletions test/commands-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ describe('mapshaper-run-commands.js', function () {
})
});

it('Fix: -i command throws error when there are multiple target datasets',async function() {
var a = 'foo\na';
var b = 'bar\nb';
var c = 'baz\nc';
var cmd = '-i a.csv -i b.csv -target * -i c.csv -o';
var out = await api.applyCommands(cmd, {'a.csv': a, 'b.csv': b, 'c.csv': c});
assert.equal(out['c.csv'], c);
})

describe('Issue #264 applyCommands()', function() {
it ('should throw error if input is a file path, not file content', function(done) {
mapshaper.applyCommands('-i input.shp -o out.json', {'input.shp': 'test/data/two_states.shp'}, function(
Expand Down

0 comments on commit a83f8ce

Please sign in to comment.