{"id":15191226,"url":"https://github.com/nushell-prophet/dotnu","last_synced_at":"2025-10-02T06:32:16.507Z","repository":{"id":225177918,"uuid":"765281183","full_name":"nushell-prophet/dotnu","owner":"nushell-prophet","description":"dotnu - tools for Nushell module developers 🛠️","archived":false,"fork":false,"pushed_at":"2025-01-21T04:06:07.000Z","size":329,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T05:18:32.676Z","etag":null,"topics":["cool-stuff","developer-tools","nushell","terminal"],"latest_commit_sha":null,"homepage":"","language":"Nushell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nushell-prophet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-29T16:12:38.000Z","updated_at":"2025-01-21T04:06:12.000Z","dependencies_parsed_at":"2024-04-01T03:27:58.413Z","dependency_job_id":"872046eb-8a7b-45d2-9254-d87dfc292af9","html_url":"https://github.com/nushell-prophet/dotnu","commit_stats":null,"previous_names":["nushell-prophet/dotnu"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nushell-prophet%2Fdotnu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nushell-prophet%2Fdotnu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nushell-prophet%2Fdotnu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nushell-prophet%2Fdotnu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nushell-prophet","download_url":"https://codeload.github.com/nushell-prophet/dotnu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234951862,"owners_count":18912480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cool-stuff","developer-tools","nushell","terminal"],"created_at":"2024-09-27T21:00:43.002Z","updated_at":"2025-10-02T06:32:16.501Z","avatar_url":"https://github.com/nushell-prophet.png","language":"Nushell","readme":"![dotnu](https://github.com/user-attachments/assets/4fb74e46-f75b-4155-8e61-8ff75db66117)\n\n\u003ch1 align=\"center\"\u003e\u003cstrong\u003edotnu - tools for Nushell module developers 🛠️\u003c/strong\u003e\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\u003cem\u003e(A good companion for \u003ca href=\"https://github.com/nushell-prophet/numd\"\u003enumd\u003c/a\u003e)\u003c/em\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003edotnu augments Nushell with helpers for literate programming, dependency analysis, and script profiling.\u003c/p\u003e\n\n## dotnu video demo\n\n\u003ca href=\"https://youtu.be/-C7_dfLXXrE\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/fdd07bfc-7d77-4dca-8a1c-3e27ac3063f9\" alt=\"dotnu demo\" width=\"100\"/\u003e\n\u003c/a\u003e\n\n## Quickstart\n\n```nushell no-run\n\u003e git clone https://github.com/nushell-prophet/dotnu; cd dotnu\n\u003e use dotnu\n```\n\n## Embeds — keeping examples in sync\n\n`dotnu` lets you write **literate Nushell**: ordinary Nushell scripts that include the real command output right after each pipeline ending in `| print $in`. See the [capture example](/dotnu-capture.nu) to grasp the idea quickly.\n\nThe `| print $in` suffix acts as a simple `print` in native Nushell and as a capture marker for dotnu, so scripts remain valid and functional even when run without loading the `dotnu` module.\n\nThe main command is `dotnu embeds-update`.\n\n`dotnu embeds-update` takes a script, rewrites every `print $in` line so its output is easy to parse, runs the modified script, captures what each marked line prints, and then replaces the old `# =\u003e` blocks in the original file with the fresh output.\n\nYou can run it on a file path (e.g., `dotnu embeds-update dotnu-capture.nu`) or pipe a script into it (e.g., `\"ls | print $in\" | dotnu embeds-update`).\n\n```nushell\n\u003e dotnu embeds-update --help\n# =\u003e Inserts captured output back into the script at capture points\n# =\u003e\n# =\u003e Usage:\n# =\u003e   \u003e embeds-update {flags} (file)\n# =\u003e\n# =\u003e Flags:\n# =\u003e   --echo: output updates to stdout\n# =\u003e   -h, --help: Display the help message for this command\n# =\u003e\n# =\u003e Parameters:\n# =\u003e   file \u003cpath\u003e:  (optional)\n# =\u003e\n# =\u003e Input/output types:\n# =\u003e   ╭─#─┬──input──┬─output──╮\n# =\u003e   │ 0 │ string  │ nothing │\n# =\u003e   │ 1 │ string  │ string  │\n# =\u003e   │ 2 │ nothing │ string  │\n# =\u003e   │ 3 │ nothing │ nothing │\n# =\u003e   ╰─#─┴──input──┴─output──╯\n# =\u003e\n```\n\n### Embeds helper commands\n\nWhile it is easy to write scripts in editor, there are several convenience helper commands that facilitate populating script files from terminal.\n\n### `dotnu embeds-setup`\n\ndefine or change the capture file (add `--auto-commit` to auto‑commit snapshots).\n\n```nu\n\u003e dotnu embeds-setup --help\n# =\u003e Set environment variables to operate with embeds\n# =\u003e\n# =\u003e Usage:\n# =\u003e   \u003e embeds-setup {flags} (path)\n# =\u003e\n# =\u003e Flags:\n# =\u003e   --auto-commit\n# =\u003e   -h, --help: Display the help message for this command\n# =\u003e\n# =\u003e Parameters:\n# =\u003e   path \u003cpath\u003e:  (optional)\n# =\u003e\n# =\u003e Input/output types:\n# =\u003e   ╭─#─┬─input─┬─output─╮\n# =\u003e   │ 0 │ any   │ any    │\n# =\u003e   ╰─#─┴─input─┴─output─╯\n# =\u003e\n```\n\n### `dotnu embeds-capture-start` and `dotnu embeds-capture-stop`\n\nrecord every result printed in the interactive session.\n\n```nu\n\u003e dotnu embeds-capture-start --help\n# =\u003e start capturing commands and their outputs into a file\n# =\u003e\n# =\u003e Usage:\n# =\u003e   \u003e embeds-capture-start (file)\n# =\u003e\n# =\u003e Flags:\n# =\u003e   -h, --help: Display the help message for this command\n# =\u003e\n# =\u003e Parameters:\n# =\u003e   file \u003cpath\u003e:  (optional, default: 'dotnu-capture.nu')\n# =\u003e\n# =\u003e Input/output types:\n# =\u003e   ╭─#─┬──input──┬─output──╮\n# =\u003e   │ 0 │ nothing │ nothing │\n# =\u003e   ╰─#─┴──input──┴─output──╯\n# =\u003e\n```\n\n### `dotnu embed-add`\n\ncapture only the pipeline you run it on; useful for fine‑grained examples.\n\n```nu\n\u003e dotnu embed-add --help\n# =\u003e Embed stdin together with its command into the file\n# =\u003e\n# =\u003e Usage:\n# =\u003e   \u003e embed-add {flags}\n# =\u003e\n# =\u003e Flags:\n# =\u003e   -p, --pipe-further: output input further to the pipeline\n# =\u003e   --published: output the published representation into terminal\n# =\u003e   --dry_run: todo: --\n# =\u003e   -h, --help: Display the help message for this command\n# =\u003e\n# =\u003e Input/output types:\n# =\u003e   ╭─#─┬─input─┬─output─╮\n# =\u003e   │ 0 │ any   │ any    │\n# =\u003e   ╰─#─┴─input─┴─output─╯\n# =\u003e\n```\n\n### `dotnu embeds-remove`\n\nstrip all captured output, leaving clean code.\n\n```nu\n\u003e dotnu embeds-remove --help\n# =\u003e Removes annotation lines starting with \"# =\u003e \" from the script\n# =\u003e\n# =\u003e Usage:\n# =\u003e   \u003e embeds-remove\n# =\u003e\n# =\u003e Flags:\n# =\u003e   -h, --help: Display the help message for this command\n# =\u003e\n# =\u003e Input/output types:\n# =\u003e   ╭─#─┬─input─┬─output─╮\n# =\u003e   │ 0 │ any   │ any    │\n# =\u003e   ╰─#─┴─input─┴─output─╯\n# =\u003e\n```\n\n## Commands\n\n### dotnu dependencies\n\n```nushell\n\u003e dotnu dependencies --help\n# =\u003e Check .nu module files to determine which commands depend on other commands.\n# =\u003e\n# =\u003e Usage:\n# =\u003e   \u003e dependencies {flags} ...(paths)\n# =\u003e\n# =\u003e Flags:\n# =\u003e   --keep-builtins: keep builtin commands in the result page\n# =\u003e   --definitions-only: output only commands' names definitions\n# =\u003e   -h, --help: Display the help message for this command\n# =\u003e\n# =\u003e Parameters:\n# =\u003e   ...paths \u003cpath\u003e: paths to nushell module files\n# =\u003e\n# =\u003e Input/output types:\n# =\u003e   ╭─#─┬─input─┬─output─╮\n# =\u003e   │ 0 │ any   │ any    │\n# =\u003e   ╰─#─┴─input─┴─output─╯\n# =\u003e\n# =\u003e Examples:\n# =\u003e\n# =\u003e   \u003e dotnu dependencies ...(glob tests/assets/module-say/say/*.nu)\n# =\u003e   ╭─#──┬──caller───┬─filename_of_caller──┬──callee───┬─step──╮\n# =\u003e   │ 0  │ hello     │ hello.nu            │           │     0 │\n# =\u003e   │ 1  │ question  │ ask.nu              │           │     0 │\n# =\u003e   │ 2  │ say       │ mod.nu              │ hello     │     0 │\n# =\u003e   │ 3  │ say       │ mod.nu              │ hi        │     0 │\n# =\u003e   │ 4  │ say       │ mod.nu              │ question  │     0 │\n# =\u003e   │ 5  │ hi        │ mod.nu              │           │     0 │\n# =\u003e   │ 6  │ test-hi   │ test-hi.nu          │ hi        │     0 │\n# =\u003e   ╰─#──┴──caller───┴─filename_of_caller──┴──callee───┴─step──╯\n# =\u003e\n```\n\n### dotnu filter-commands-with-no-tests\n\n```nushell\n\u003e dotnu filter-commands-with-no-tests --help\n# =\u003e Filter commands after `dotnu dependencies` that aren't used by any other command containing `test` in its name.\n# =\u003e\n# =\u003e Usage:\n# =\u003e   \u003e filter-commands-with-no-tests\n# =\u003e\n# =\u003e Flags:\n# =\u003e   -h, --help: Display the help message for this command\n# =\u003e\n# =\u003e Input/output types:\n# =\u003e   ╭─#─┬─input─┬─output─╮\n# =\u003e   │ 0 │ any   │ any    │\n# =\u003e   ╰─#─┴─input─┴─output─╯\n# =\u003e\n# =\u003e Examples:\n# =\u003e\n# =\u003e   \u003e dependencies ...(glob tests/assets/module-say/say/*.nu) | filter-commands-with-no-tests\n# =\u003e   ╭─#─┬──caller──┬─filename_of_caller─╮\n# =\u003e   │ 0 │ hello    │ hello.nu           │\n# =\u003e   │ 1 │ question │ ask.nu             │\n# =\u003e   │ 2 │ say      │ mod.nu             │\n# =\u003e   ╰─#─┴──caller──┴─filename_of_caller─╯\n# =\u003e\n```\n\n### dotnu set-x\n\n`dotnu set-x` opens a regular .nu script. It divides it into blocks using the specified regex (by default, it is \"\\n\\n\") and generates a new script that will print the code of each block before executing it, along with the timings of each block's execution.\n\nLet's check the code of the simple `set-x-demo.nu` script\n\n```nushell\n\u003e let $filename = [tests assets set-x-demo.nu] | path join\n\u003e open $filename | lines | table -i false\n# =\u003e ╭──────────────╮\n# =\u003e │ sleep 0.5sec │\n# =\u003e │              │\n# =\u003e │ sleep 0.7sec │\n# =\u003e │              │\n# =\u003e │ sleep 0.8sec │\n# =\u003e ╰──────────────╯\n```\n\nLet's see how `dotnu set-x` will modify this script\n\n```nushell\n\u003e dotnu set-x $filename --echo | lines | table -i false\n# =\u003e ╭────────────────────────────────────────────────────────────╮\n# =\u003e │ mut $prev_ts = ( date now )                                │\n# =\u003e │ print (\"\u003e sleep 0.5sec\" | nu-highlight)                    │\n# =\u003e │ sleep 0.5sec                                               │\n# =\u003e │ print $'(ansi grey)((date now) - $prev_ts)(ansi reset)'... │\n# =\u003e │                                                            │\n# =\u003e │                                                            │\n# =\u003e │ print (\"\u003e sleep 0.7sec\" | nu-highlight)                    │\n# =\u003e │ sleep 0.7sec                                               │\n# =\u003e │ print $'(ansi grey)((date now) - $prev_ts)(ansi reset)'... │\n# =\u003e │                                                            │\n# =\u003e │                                                            │\n# =\u003e │ print (\"\u003e sleep 0.8sec\" | nu-highlight)                    │\n# =\u003e │ sleep 0.8sec                                               │\n# =\u003e │ print $'(ansi grey)((date now) - $prev_ts)(ansi reset)'... │\n# =\u003e │                                                            │\n# =\u003e │                                                            │\n# =\u003e ╰────────────────────────────────────────────────────────────╯\n```\n","funding_links":[],"categories":["Scripts"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnushell-prophet%2Fdotnu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnushell-prophet%2Fdotnu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnushell-prophet%2Fdotnu/lists"}