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