mirror of
https://github.com/onyx-and-iris/meld-cli.git
synced 2025-07-11 18:01:45 +00:00
add screenshot/clip commands
This commit is contained in:
parent
fd808decc3
commit
e65de7ebec
42
index.js
42
index.js
@ -270,7 +270,7 @@ socket.onopen = function () {
|
||||
})
|
||||
break
|
||||
case 'status':
|
||||
channel = new QWebChannel(socket, function (channel) { // eslint-disable-line no-unused-vars
|
||||
channel = new QWebChannel(socket, function (channel) {
|
||||
recordStatus(channel)
|
||||
.then((message) => {
|
||||
console.log(message)
|
||||
@ -289,6 +289,46 @@ socket.onopen = function () {
|
||||
socket.close()
|
||||
process.exit(0)
|
||||
}
|
||||
} else if (input[0] === 'clip') {
|
||||
if (flags.help) {
|
||||
console.log(`usage: meld-cli clip`)
|
||||
socket.close()
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
channel = new QWebChannel(socket, function (channel) {
|
||||
const meld = channel.objects.meld
|
||||
|
||||
meld.sendCommand('meld.recordClip').then(() => {
|
||||
console.log('Clip command sent successfully.')
|
||||
socket.close()
|
||||
process.exit(0)
|
||||
}).catch((err) => {
|
||||
console.error(`${err}`)
|
||||
socket.close()
|
||||
process.exit(1)
|
||||
})
|
||||
})
|
||||
} else if (input[0] === 'screenshot') {
|
||||
if (flags.help) {
|
||||
console.log(`usage: meld-cli screenshot`)
|
||||
socket.close()
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
channel = new QWebChannel(socket, function (channel) {
|
||||
const meld = channel.objects.meld
|
||||
|
||||
meld.sendCommand('meld.screenshot').then(() => {
|
||||
console.log('Screenshot command sent successfully.')
|
||||
socket.close()
|
||||
process.exit(0)
|
||||
}).catch((err) => {
|
||||
console.error(`${err}`)
|
||||
socket.close()
|
||||
process.exit(1)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
console.log('Unknown command. Use meld-cli --help for available commands.')
|
||||
socket.close()
|
||||
|
58
package-lock.json
generated
58
package-lock.json
generated
@ -86,14 +86,20 @@
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "8.57.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz",
|
||||
"integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==",
|
||||
"node_modules/@eslint/eslintrc/node_modules/globals": {
|
||||
"version": "13.24.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
|
||||
"integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"type-fest": "^0.20.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/config-array": {
|
||||
@ -1520,6 +1526,16 @@
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/@eslint/js": {
|
||||
"version": "8.57.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz",
|
||||
"integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
@ -1537,6 +1553,22 @@
|
||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/globals": {
|
||||
"version": "13.24.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
|
||||
"integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"type-fest": "^0.20.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/esniff": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz",
|
||||
@ -1887,22 +1919,6 @@
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/globals": {
|
||||
"version": "13.24.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
|
||||
"integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"type-fest": "^0.20.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/globalthis": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz",
|
||||
|
34
package.json
34
package.json
@ -20,7 +20,8 @@
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"lint": "standard",
|
||||
"lint:fix": "standard --fix"
|
||||
},
|
||||
"bin": {
|
||||
"meld-cli": "index.js"
|
||||
@ -35,5 +36,36 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"standard": "^17.1.2"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
"dist",
|
||||
"coverage",
|
||||
"test",
|
||||
"tests",
|
||||
"examples",
|
||||
"example",
|
||||
"docs",
|
||||
"doc"
|
||||
],
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"es2021": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 12,
|
||||
"sourceType": "module"
|
||||
}
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"standard"
|
||||
],
|
||||
"rules": {
|
||||
"no-unused-vars": "off",
|
||||
"no-console": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,12 @@ const commands = {
|
||||
},
|
||||
record: {
|
||||
desc: 'Manage recording'
|
||||
},
|
||||
clip: {
|
||||
desc: 'Save a clip'
|
||||
},
|
||||
screenshot: {
|
||||
desc: 'Take a screenshot'
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user