Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rearrange logic in output_mapping #162

Merged
merged 1 commit into from
Aug 18, 2016
Merged
Changes from all 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
19 changes: 10 additions & 9 deletions scripts/output_mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ var schema = require('../schema');
var _index = ( process.argv.length > 3 ) ? process.argv[3] : config.schema.indexName;
var _type = ( process.argv.length > 2 ) ? process.argv[2] : null; // get type from cli args

if( !_type ){
// print out mapping for just one type
if ( _type ) {
var mapping = schema.mappings[_type];
if( !mapping ){
console.error( 'could not find a mapping in the schema file for', _index+'/'+_type );
process.exit(1);
}
console.log( JSON.stringify( mapping, null, 2 ) );
//print out the entire schema mapping
} else {
console.log( JSON.stringify( schema, null, 2 ) );
process.exit(0);
}

var mapping = schema.mappings[_type];
if( !mapping ){
console.error( 'could not find a mapping in the schema file for', _index+'/'+_type );
process.exit(1);
}

console.log( JSON.stringify( mapping, null, 2 ) );