code: def do_edit(self, args: argparse.Namespace) -> None:
          
          if not self.editor:
              raise EnvironmentError("Please use 'set editor' to specify your text editing program of choice.")
  
          command = utils.quote_string_if_needed(os.path.expanduser(self.editor))
          if args.file_path:
              command += " " + utils.quote_string_if_needed(os.path.expanduser(args.file_path))
  
          self.do_shell(command)
docs: Edit a file in a text editor