2020-11-07 17:59:37 +02:00
|
|
|
import { CommandRuntime, CommandDeclaration } from '@joplin/lib/services/CommandService';
|
|
|
|
import { _ } from '@joplin/lib/locale';
|
2021-10-01 20:35:27 +02:00
|
|
|
const app = require('@electron/remote').app;
|
2020-10-09 19:35:46 +02:00
|
|
|
const { clipboard } = require('electron');
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
export const declaration: CommandDeclaration = {
|
2020-10-09 19:35:46 +02:00
|
|
|
name: 'copyDevCommand',
|
|
|
|
label: () => _('Copy dev mode command to clipboard'),
|
|
|
|
};
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
export const runtime = (): CommandRuntime => {
|
2020-10-09 19:35:46 +02:00
|
|
|
return {
|
|
|
|
execute: async () => {
|
|
|
|
const appPath = app.getPath('exe');
|
|
|
|
const cmd = `${appPath} --env dev`;
|
|
|
|
clipboard.writeText(cmd);
|
|
|
|
alert(`The dev mode command has been copied to clipboard:\n\n${cmd}`);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|