How to use the env-editor.getEditor function in env-editor

To help you get started, we’ve selected a few env-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-cli / packages / amplify-cli / src / extensions / amplify-helpers / open-editor.js View on Github external
async function openEditor(context, filePath) {
  const continueQuestion = {
    type: 'input',
    name: 'pressKey',
    message: 'Press enter to continue',
  };

  // Check if default editor is chosen in init step
  const { defaultEditor } = getEnvInfo();

  const editorSelected = defaultEditor || (await editorSelection());

  if (editorSelected !== 'none') {
    const editorArguments = [];
    const editor = envEditor.getEditor(editorSelected);

    if (!editor) {
      console.error(
        `Selected editor '${editorSelected}' was not found in your machine. Please open your favorite editor and modify the file if needed.`
      );
    }
    const editorPath = editor.paths.find(p => fs.existsSync(p));

    if (editorSelected === 'vscode') {
      editorArguments.push('--goto');
    }

    editorArguments.push(filePath);

    try {
      if (!editor.isTerminalEditor) {

env-editor

Get metadata on the default editor or a specific editor

MIT
Latest version published 3 years ago

Package Health Score

68 / 100
Full package analysis