mirror of
https://github.com/onyx-and-iris/meld-cli.git
synced 2026-04-09 02:43:35 +00:00
dry up the help logic
clip/screenshot are now command groups.
This commit is contained in:
@@ -1,11 +1,30 @@
|
||||
function recordClip(channel) {
|
||||
return new Promise((resolve, reject) => {
|
||||
channel.objects.meld.sendCommand('meld.recordClip').then(() => {
|
||||
resolve('Clip command sent successfully.')
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
import meowHelp from 'cli-meow-help'
|
||||
|
||||
const clipHelp = meowHelp({
|
||||
name: 'meld-cli clip',
|
||||
desc: 'Manage clips in Meld',
|
||||
commands: {
|
||||
save: {
|
||||
desc: 'Save a clip'
|
||||
}
|
||||
},
|
||||
flags: {
|
||||
help: {
|
||||
type: 'boolean',
|
||||
shortFlag: 'h',
|
||||
desc: 'Display help information'
|
||||
}
|
||||
},
|
||||
defaults: false
|
||||
})
|
||||
|
||||
async function saveClip(channel) {
|
||||
try {
|
||||
await channel.objects.meld.sendCommand('meld.recordClip');
|
||||
return 'Clip command sent successfully.';
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export { recordClip }
|
||||
export { clipHelp, saveClip }
|
||||
|
||||
@@ -1,11 +1,30 @@
|
||||
function recordScreenshot(channel) {
|
||||
return new Promise((resolve, reject) => {
|
||||
channel.objects.meld.sendCommand('meld.screenshot').then(() => {
|
||||
resolve('Screenshot command sent successfully.')
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
import meowHelp from 'cli-meow-help'
|
||||
|
||||
const screenshotHelp = meowHelp({
|
||||
name: 'meld-cli screenshot',
|
||||
desc: 'Manage screenshots in Meld',
|
||||
commands: {
|
||||
take: {
|
||||
desc: 'Take a screenshot'
|
||||
}
|
||||
},
|
||||
flags: {
|
||||
help: {
|
||||
type: 'boolean',
|
||||
shortFlag: 'h',
|
||||
desc: 'Display help information'
|
||||
}
|
||||
},
|
||||
defaults: false
|
||||
})
|
||||
|
||||
async function takeScreenshot(channel) {
|
||||
try {
|
||||
await channel.objects.meld.sendCommand('meld.screenshot');
|
||||
return 'Screenshot command sent successfully.';
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export { recordScreenshot }
|
||||
export { screenshotHelp, takeScreenshot }
|
||||
Reference in New Issue
Block a user