How to use external-editor - 6 common examples

To help you get started, we’ve selected a few external-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 ivangreene / arena-cli / index.js View on Github external
return arena[method](slug).get().then(item => {
          let content = {}, before = {};
          if (argv.yaml) {
            before = pick(item, editable);
            content = yaml.safeLoad(editor.edit(yaml.safeDump(before,
              { lineWidth: 78 })));
          } else {
            before[editable[0]] = item[editable[0]];
            content[editable[0]] = editor.edit(before[editable[0]])
              .replace(/[\r\n]+$/, '');
          }
          if (!isEqual(content, before)) {
            // Use Object.assign: currently a bug in are.na's API prevents
            // updating partially without wiping out the other fields (i.e.:
            // passing only "content" to be updated will wipe out title and
            // description if they are not set)
            return arena[method](item.id)
              .update(Object.assign({}, pick(item, editable), content))
              .then(result => {
                // Returns new object for channels, not blocks
                return Promise.resolve((result ? result.id : slug) + ': OK.');
              });
          } else {
            return Promise.resolve(slug + ': No change, not updated.');
          }
github ivangreene / arena-cli / index.js View on Github external
return arena[method](slug).get().then(item => {
          let content = {}, before = {};
          if (argv.yaml) {
            before = pick(item, editable);
            content = yaml.safeLoad(editor.edit(yaml.safeDump(before,
              { lineWidth: 78 })));
          } else {
            before[editable[0]] = item[editable[0]];
            content[editable[0]] = editor.edit(before[editable[0]])
              .replace(/[\r\n]+$/, '');
          }
          if (!isEqual(content, before)) {
            // Use Object.assign: currently a bug in are.na's API prevents
            // updating partially without wiping out the other fields (i.e.:
            // passing only "content" to be updated will wipe out title and
            // description if they are not set)
            return arena[method](item.id)
              .update(Object.assign({}, pick(item, editable), content))
              .then(result => {
                // Returns new object for channels, not blocks
                return Promise.resolve((result ? result.id : slug) + ': OK.');
github sx1989827 / DOClever / node_modules / inquirer / lib / prompts / editor.js View on Github external
Prompt.prototype.startExternalEditor = function () {
  // Pause Readline to prevent stdin and stdout from being modified while the editor is showing
  this.rl.pause();
  ExternalEditor.editAsync(this.currentText, this.endExternalEditor.bind(this));
};
github graalvm / graaljs / tools / node_modules / eslint / node_modules / inquirer / lib / prompts / editor.js View on Github external
startExternalEditor() {
    // Pause Readline to prevent stdin and stdout from being modified while the editor is showing
    this.rl.pause();
    editAsync(this.currentText, this.endExternalEditor.bind(this));
  }
github SBoudrias / Inquirer.js / packages / inquirer / lib / prompts / editor.js View on Github external
startExternalEditor() {
    // Pause Readline to prevent stdin and stdout from being modified while the editor is showing
    this.rl.pause();
    editAsync(this.currentText, this.endExternalEditor.bind(this));
  }
github rei / rei-cedar-docs / node_modules / inquirer / lib / prompts / editor.js View on Github external
Prompt.prototype.startExternalEditor = function () {
  // Pause Readline to prevent stdin and stdout from being modified while the editor is showing
  this.rl.pause();
  ExternalEditor.editAsync(this.currentText, this.endExternalEditor.bind(this));
};

external-editor

Edit a string with the users preferred text editor using $VISUAL or $ENVIRONMENT

MIT
Latest version published 5 years ago

Package Health Score

65 / 100
Full package analysis

Popular external-editor functions