From a8678f419b746c7073403592dbf2cd6803d5b45b Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Mon, 22 Dec 2014 10:08:12 -0400 Subject: [PATCH] Implement "project" global option --- lib/app.coffee | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/app.coffee b/lib/app.coffee index 99a1df25..e52bc6f0 100644 --- a/lib/app.coffee +++ b/lib/app.coffee @@ -31,6 +31,12 @@ capitano.globalOption boolean: true alias: 'q' +capitano.globalOption + signature: 'project' + parameter: 'path' + description: 'project path' + alias: 'p' + yesOption = signature: 'yes' description: 'confirm non interactively' @@ -479,9 +485,18 @@ capitano.command cli = capitano.parse(process.argv) +changeProjectDirectory = (directory) -> + try + process.chdir(directory) + catch + resin.errors.handle(new Error("Invalid project: #{directory}")) + resin.data.prefix.set resin.settings.get('dataPrefix'), (error) -> resin.errors.handle(error) if error? resin.log.setQuiet(cli.global.quiet) + if cli.global.project? + changeProjectDirectory(cli.global.project) + capitano.execute(cli)