Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4009

The shell's new 'edit' command could edit line text as well as objects

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.1.1
    • Affects Version/s: None
    • Component/s: Shell
    • Labels:
      None
    • Environment:
      Any
    • Fully Compatible

      The code for the 'edit' command in shell/dbshell.cpp scans the line it is passed to see if parses as the name of an object or property. If the text is not the name of an object, it prints "can only edit variable or property" and returns.

      But it could just as easily save the text of the line to the temporary file it creates and pass the input line to the editor. Especially combined with command line recall of multi-line commands, this could be pretty helpful to heavy shell users.

      Type a very long multi-line bit of JavaScript and get an error from the shell. Press up-arrow to recall the entire command, press Home to go to the beginning of the line, type "edit " and hit return. Your multi-line command is now in the editor.

      Note that multi-line commands have to have newlines stripped (replaced by spaces) to work right with the line oriented editing of the command line and also to be compatible with the history file. We could be fancy and pretty up the text before passing it to the editor and then strip newlines again on return, but the feature would be useful even without that.

            Assignee:
            tad Tad Marshall
            Reporter:
            tad Tad Marshall
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: