Skip to main content

Module edit

Module edit 

Source
Expand description

Editor integration for bn edit command.

This module provides low-level file operations for editing beans:

  • Launching an external editor subprocess
  • Creating backups before editing
  • Validating and saving edited content
  • Rebuilding indices after modifications
  • Prompting user for rollback on validation errors

Functions§

cmd_edit
Orchestrate the complete bn edit workflow for a bean.
load_backup
Load file content into memory as a backup before editing.
open_editor
Open a file in the user’s configured editor.
prompt_rollback
Prompt user for action when validation fails: retry, rollback, or abort.
rebuild_index_after_edit
Rebuild the bean index from current bean files on disk.
validate_and_save
Validate bean content and persist it to disk with updated timestamp.