nushell-prophet / numd

numd - reproducible Nushell Markdown documents
The Unlicense
14 stars 0 forks source link

Improve code readability #13

Closed maxim-uvarov closed 6 months ago

maxim-uvarov commented 6 months ago

> git diff (git describe --tags --abbrev=0 HEAD) HEAD -- nudoc/run.nu | aichat 'summarize changes' The changes made are as follows:

  1. Updated the comments and the description of the function to be more clear and descriptive.
  2. Changed the default output file extension from any file to specifically a .md file.
  3. Modified the assemble-script function to handle errors and enclose > commands into try blocks to avoid errors and output their messages.
  4. Added a new function backup-file to create a backup of the file before overwriting it.
  5. Added new functions escape-quotes, nudoc-block, highlight-command, trim-comments-plus, try-append-echo-in, try-handle-errors, and execute-code.
  6. Updated the assemble-script function to make use of the new functions added.
  7. Added a new function parse-block-index to parse the block index from the Nu output lines.
  8. Updated the assemble-results function to utilize the new functions and provide a more refined output.