refactor: improve code clarity with better naming#89
Merged
maxim-uvarov merged 12 commits intoDec 13, 2025
Conversation
Add tests for check-print-append, get-last-span to verify correct output detection when commands contain source, overlay, alias, or use statements in multi-statement contexts.
These statements don't produce output that should be appended.
- Replace `sys host | get boot_time` with `str length` in README - Use fixed datetime instead of `date now` in timezone example - Update error-with-try.md with current nushell error format
Consolidates `create-catch-error-current-instance` and `create-catch-error-outside` into a single `wrap-in-try-catch` function with a `--new-instance` flag. This reduces code duplication and simplifies the call site in `create-execution-code`.
…g helper Extracts the output formatting logic from create-execution-code into a new apply-output-formatting helper function. This improves code organization by separating concerns - the new function specifically handles 'no-output' and 'separate-block' fence options with clearer control flow.
Remove inaccurate description of REPL-style `>` command handling which doesn't exist in the codebase. Replace with accurate documentation of how numd actually processes code blocks: splitting by blank lines into command groups, executing each group separately, and handling `# =>` output markers.
…options - Update commands.nu line count from ~840 to ~865 lines - Add missing nu-utils/ directory to module structure - Document separate-block/s option for code block output formatting - Correct Expected Non-Zero Diffs section to reference actual dynamic content (git tag instead of non-existent sys host boot_time) - Clarify that Nushell version changes affect table rendering and error formatting
Add step 3 to Integration Tests section noting that `numd run README.md` is executed to update README with latest outputs during the testing-integration command.
Renamed variables for better code readability: - convert-output-fences: a/b → expanded_format/compact_format - convert-output-fences: --back flag → --restore - get-last-span: s/f/len → start/end/offset Updated corresponding test to use new --restore flag name.
c0f69a0 to
91f4901
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Command Renames
match-action→classify-block-actioncheck-print-append→can-append-printremove-comments-plus→trim-trailing-commentstoggle-output-fences→convert-output-fencesgenerate-tags→generate-block-markersmark-code-block→code-block-markercreate-highlight-command→generate-highlight-printcreate-indented-output→generate-inline-output-pipelinecreate-execution-code→generate-block-executionfind-code-blocks→parse-markdown-to-blocksmodify-path→build-modified-pathexecute-block-lines→process-code-block-contentescape-special-characters-and-quote→quote-for-printcreate-fence-output→generate-separate-block-fencegenerate-print-lines→join-and-printapply-output-formatting→format-command-outputVariable Renames
convert-output-fences:a/b→expanded_format/compact_formatconvert-output-fences:--back→--restoreget-last-span:s/f/len→start/end/offsetRefactoring
format-command-outputTests
Docs
Test plan
nu toolkit.nu testing-integration