Sha256: c339a4c822ae50369ac60fb4ae7d27226cda6864ad55a491559ecd5ed5e922ba

Contents?: true

Size: 1.37 KB

Versions: 26

Compression:

Stored size: 1.37 KB

Contents

#!/usr/bin/env node

var optimist = require('optimist'),
	importFile = require('./index.js');

	var argv = optimist
		.usage(
			  "Usage: \033[1mimport\033[0m [options] [file …]\n\n"
			+ "Version: 0.0.5\n\n"
			+ "Minimized fork of smash.\n"
			+ "Concatenates one or more input files, outputting a single merged file.\n"
			+ "Any import statements in the input files are expanded in-place to the\n"
			+ "contents of the imported file. If the same file is imported multiple\n"
			+ "times, only the first instance of the file is included."
		)
		.options("list", {
			describe: "output a list of imported files",
			type: "boolean",
			default: false
		})
		.options("delimiter", {
			describe: "specify the delimiter used for concatenating files",
			type: "string",
			default: "\n"
		})
		.options("ignore-missing", {
			describe: "ignore missing files instead of throwing an error",
			type: "boolean",
			default: false
		})
		.options("help", {
			describe: "display this helpful message",
			type: "boolean",
			default: false
		})
		.check(function(argv) {
			if (argv.help){ return optimist.showHelp(); }
			if (!argv._.length){ throw new Error("input required"); }
			if (argv.list && argv.graph){ throw new Error("--list and --graph are exclusive"); }
		})
		.argv;

// Output to stdout
console.log( argv._.map(function(fileName){
	return importFile(fileName);
}).join(argv.delimiter) );

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.25 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.24 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.23 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.22 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.21 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.20 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.19 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.18 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.17 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.16 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.15 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.14 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.13 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.12 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.11 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.10 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.9 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.8 lib/clapton/javascripts/node_modules/import/import
clapton-0.0.7 lib/clapton/javascripts/node_modules/import/import