openfin-cli
Advanced tools
Comparing version 0.0.1 to 0.0.2
65
index.js
@@ -7,2 +7,21 @@ 'use strict'; | ||
function main(str, flags) { | ||
var name = flags.n || flags.name, | ||
url = flags.u || flags.url, | ||
config = flags.c || flags.config || 'config.json', | ||
launch = flags.l || flags.launch; | ||
if (isEmpty(flags)) { | ||
console.log('please see options: openfin --help'); | ||
return; | ||
} | ||
writeToConfig(name, url, config, function () { | ||
if (launch) { | ||
launchOpenfin(config); | ||
} | ||
}); | ||
} | ||
//makeshift is object empty function | ||
function isEmpty(flags) { | ||
@@ -16,18 +35,17 @@ for (var key in flags) { | ||
} | ||
module.exports = function(str, flags) { | ||
var name = flags.n || flags.name, | ||
url = flags.u || flags.url, | ||
config = flags.c || flags.config || 'config.json', | ||
launch = flags.l || flags.launch, | ||
startup_app = {}, | ||
//will launch download the rvm and launch openfin | ||
function launchOpenfin (config) { | ||
openfinLauncher.launchOpenFin({ | ||
configPath: path.resolve(config) | ||
}).fail(function(err) { | ||
console.log('launch failed', err); | ||
}); | ||
} | ||
//write the specified config to disk. | ||
function writeToConfig(name, url, config, callback) { | ||
var startup_app = {}, | ||
configAction; | ||
if (isEmpty(flags)) { | ||
console.log('please see options: openfin --help'); | ||
return; | ||
} | ||
// console.log('name is:', name || 'you did not specify a name, falling back to defaults'); | ||
// console.log('url is:', url || 'you did not specify a url, falling back to defaults'); | ||
// console.log('config file location is:', path.resolve(config)); | ||
fs.exists(config, function(exists) { | ||
@@ -48,19 +66,14 @@ if (exists) { | ||
//we take the specified action. | ||
//create or update the config | ||
configAction({ | ||
startup_app: startup_app | ||
}, config).then(function() { | ||
console.log('created config file:', path.resolve(config)); | ||
if (launch) { | ||
openfinLauncher.launchOpenFin({ | ||
configPath: path.resolve(config) | ||
}).fail(function(err) { | ||
console.log('launch failed', err); | ||
}); | ||
} | ||
}).fail(function(err) { | ||
}, config).fail(function(err) { | ||
console.log(err); | ||
}).done(function (){ | ||
callback(); | ||
}); | ||
}); | ||
} | ||
}; | ||
module.exports = main; |
{ | ||
"name": "openfin-cli", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "OpenFin Runtime cli tool", | ||
@@ -5,0 +5,0 @@ "homepage": "http://www.openfin.co", |
@@ -23,3 +23,37 @@ > OpenFin Runtime cli tool | ||
##Examples | ||
####Launching an application | ||
```sh | ||
$ openfin --launch --url http://www.openfin.co | ||
``` | ||
Shorthand | ||
```sh | ||
$ openfin -l -u http://www.openfin.co | ||
``` | ||
####Creating a config file | ||
```sh | ||
$ openfin --config myconfig.json --name myAppName --url http://www.openfin.co | ||
``` | ||
Shorthand | ||
```sh | ||
$ openfin -c myconfig.json -n myAppName -u http://www.openfin.co | ||
``` | ||
####Launching a given config file | ||
```sh | ||
$ openfin --launch --config myconfig.json | ||
``` | ||
Shorthand | ||
```sh | ||
$ openfin -l -c myconfig.json | ||
``` | ||
## License | ||
@@ -26,0 +60,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4831
84
69