get-open-apps
Advanced tools
Comparing version 1.0.1 to 1.0.2
14
index.js
@@ -8,13 +8,9 @@ module.exports = async function(opt) { | ||
} = require('util'); | ||
const ps = promisify(require('ps-node').lookup); | ||
const spawn = require('await-spawn'); | ||
let appsOpen = []; | ||
let processes = await ps({ | ||
command: '', | ||
arguments: '' | ||
}); | ||
for (let i = 0; i < processes.length; i++) { | ||
let process = processes[i].command; | ||
let regex = /(?:\/Applications)(?:\/[^\/\.]*\/|\/)*(?:([^\.]+)\.app)/; | ||
let app = process.match(regex); | ||
let psOut = (await spawn('/bin/ps', ['-A'])).toString(); | ||
let regex = /(?:\/Applications)(?:\/[^\/\.]*\/|\/)*(?:([^\.]+)\.app)/gm; | ||
let app; | ||
while (app = regex.exec(psOut)) { | ||
if (app && !appsOpen[app[1]]) { | ||
@@ -21,0 +17,0 @@ appsOpen[app[1]] = app[0]; |
@@ -7,3 +7,3 @@ { | ||
"dependencies": { | ||
"ps-node": "^0.1.6" | ||
"await-spawn": "^2.1.1" | ||
}, | ||
@@ -24,7 +24,7 @@ "description": "Get a list of the apps the user has open.", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"first": "O='{\"name\":\"'$npm_package_name'\",\"description\":\"'$npm_package_description'\",\"license_template\":\"'$npm_package_license'\"}' && echo \"${O}\" && curl -u $npm_package_author_name https://api.github.com/user/repos -d \"${A}\" && git add -A && git commit -m \"initial\" && git remote add origin 'https://github.com/'$npm_package_author_name'/'$npm_package_name'.git' && git merge origin/master --allow-unrelated-histories -m $npm_package_version && git push --set-upstream origin master && git push && git push --tags", | ||
"premiere": "O='{\"name\":\"'$npm_package_name'\",\"description\":\"'$npm_package_description'\",\"license_template\":\"'$npm_package_license'\"}' && echo \"${O}\" && curl -u $npm_package_author_name https://api.github.com/user/repos -d \"${A}\" && git add -A && git commit -m \"initial\" && git remote add origin 'https://github.com/'$npm_package_author_name'/'$npm_package_name'.git' && git merge origin/master --allow-unrelated-histories -m $npm_package_version && git push --set-upstream origin master && git push && git push --tags", | ||
"version": "git add -A", | ||
"postversion": "git remote | xargs -L1 git push --all && git push --tags && npm publish" | ||
}, | ||
"version": "1.0.1" | ||
"version": "1.0.2" | ||
} |
@@ -11,4 +11,21 @@ # get-open-apps | ||
Returns an array like this: | ||
```JavaScript | ||
[Telegram: "/Applications/Telegram.app", Atom: "/Applications/Atom.app", Terminal: "/Applications/Utilities/Terminal.app", Splice: "/Applications/Splice.app", Flux: "/Applications/Flux.app"] | ||
[ | ||
Telegram: "/Applications/Telegram.app", | ||
Atom: "/Applications/Atom.app", | ||
Terminal: "/Applications/Utilities/Terminal.app", | ||
Splice: "/Applications/Splice.app", | ||
Flux: "/Applications/Flux.app" | ||
] | ||
``` | ||
### Please consider donating! | ||
If you appreciate this project and the work I've done so far please donate! Any amount is accepted. Thank you :) | ||
Ethereum: 0xb4355179da353f1BA4AA0BB5a7E3Ba4FdC7128ea | ||
Bitcoin: 1LJkyU5jdZb525sBwcx1dA2qV8kgowdcro | ||
Patreon: <https://www.patreon.com/qashto> | ||
Paypal: <https://www.paypal.me/qashto/5> |
3658
31
18
+ Addedawait-spawn@^2.1.1
+ Addedawait-spawn@2.1.2(transitive)
+ Addedbl@2.2.1(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.25.2.1(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedps-node@^0.1.6
- Removedconnected-domain@1.0.0(transitive)
- Removedps-node@0.1.6(transitive)
- Removedtable-parser@0.1.3(transitive)