How to use the cli.fatal function in cli

To help you get started, we’ve selected a few cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github simontabor / serenity / lib / Serenity.js View on Github external
self.walk(new RegExp('.*\\.html$|.*_config\\.yml$'), new RegExp('.*/_site/.*'), function(err,list) {
      // list of all html files, not in _site
      if (err) cli.fatal('Error walking through files, please try again');
      if (list.length < 1) cli.fatal('Could not find any files to convert');
      converter.run(list);
    });
    return;
github GameMakerDiscord / Rubber / src / cli.ts View on Github external
let path = resolve(args[0]);
    // !!! #4 Removed the yyz check from an older verison. This can
    //        be fixed by adding it again, extracting it somewhere temporary.
    if (statSync(path).isDirectory()) {
        // Check inside the directory
        for (const name of readdirSync(path)) {
            if (!statSync(join(path, name)).isDirectory()) {
                if (validateYYP(join(path, name))) {
                    path = join(path, name);
                    break;
                }
            }
        }
    }
    if (!existsSync(path)) {
        cli.fatal("Project does not exist at " + chalk.yellow(path) + ". Exiting");
        return;
    }

    // Preform some checks to the project.
    
    if (!validateYYP(path)) {
        cli.fatal("Project invalid, or in a newer format. Exiting");
    }

    // We have a probably valid project. Time to pass it to rubber
    let buildType: "test" | "zip" | "installer" = "test";
    if (options.zip && options.installer) {
        // why did you even?
        cli.fatal("Cannot make a zip and installer :)   Use two different cli calls. Exiting")
    }
    if (options.zip) {
github slively / loopback-discover-models / cli.js View on Github external
}
                });
            });
        });
    } else if (options.modelName) {
        dataSource.discoverSchema(options.modelName, { owner: discoveryOptions.owner }, function (err, schema) {
            if (err) {
                cli.fatal(err);
            }

            cli.info('Writing new model files for ' + schema.name);
            writeFilesForModelSchema(schema);
            process.exit();
        });
    } else {
        cli.fatal('You must either specify --allNewModels or --modelName ');
    }

    function convertModelNameToFileName(modelName) {
        return modelName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
    }

    function defaultJsFileContents(modelName) {
        return 'module.exports = function(/*'+modelName+'*/){};'
    }

    function updateModelConfig(schema) {
        var cfg = JSON.parse(fs.readFileSync(modelConfigPath));

        cfg[schema.name] = {
            dataSource: options.dataSource,
            public: true
github smfoote / tornado / bin / tornado.es6 View on Github external
function output(data, file) {
  let outputStream;
  try {
    if (file) {
      if (streams[file]) {
        outputStream = streams[file];
      } else {
        outputStream = streams[file] = cli.native.fs.createWriteStream(file);
      }
    } else {
      outputStream = process.stdout;
    }
    outputStream.write(data + cli.native.os.EOL);
  } catch (e) {
    cli.fatal('Could not write to output stream');
  }
}
github jokeyrhyme / cdn-sync / index.js View on Github external
fs.exists(target, function (exists) {
      if (exists) {
        cli.info('remove existing file or use --force');
        cli.fatal(target + ' already exists');
      } else {
        cli.fatal('`init` not implemented yet');
      }
    });
  }
github slively / loopback-discover-models / cli.js View on Github external
modelConfigPath = process.cwd() + options.modelConfigPath,
        modelsPath = process.cwd() + options.modelDir,
        dataSource,
        discoveryOptions = {
            owner: options.owner,
            relations: options.relations !== 'false',
            all: options.allOwners !== 'false',
            views: options.views !== 'false'
        };

    try {
        server = require(serverPath);
        dataSource = server.dataSources[options.dataSource];
    } catch(e) {
        cli.error(e);
        cli.fatal('Unable to require() server.js from ' + serverPath);
    }

    if (!dataSource) {
        cli.fatal('data source ' + options.dataSource + ' not found on server object.');
    }

    if (options.allNewModels !== 'false') {
        var currentModels = fs.readdirSync(modelsPath)
                .filter(function(fname){
                    return fname.match(/.*.json/g)
                })
                .map(function(fname){
                    return fs.readFileSync(modelsPath + '/' + fname);
                })
                .map(function(contents){
                    return JSON.parse(contents).name.toLowerCase();
github jokeyrhyme / cdn-sync / index.js View on Github external
fs.exists(target, function (exists) {
      if (exists) {
        cli.info('remove existing file or use --force');
        cli.fatal(target + ' already exists');
      } else {
        cli.fatal('`init` not implemented yet');
      }
    });
  }
github simontabor / serenity / convert.js View on Github external
fs.copy('./','../_templrbackup',function(err) {
    if (err) {
      cli.error(err);
      cli.fatal('Could not backup directory to ../_templrbackup');
    }
    cli.ok('Backed up directory to ../_templrbackup');
    cb();
  });
};