pub const TEMPLATE_PROBE: &str = "{%- if kind == \"summary\" -%}\n[header]dodot probe[/header]\n [dim]data_dir:[/dim] {{ data_dir }}\n\n[header]Subcommands:[/header]\n{% for sub in available %} [pack-name]{{ sub.name | col(20) }}[/pack-name] [description]{{ sub.description }}[/description]\n{% endfor %}\n{%- elif kind == \"deployment-map\" -%}\n[header]Deployment map[/header]\n [dim]file:[/dim] {{ map_path }}\n\n{% if entries %} [dim]{{ \"pack\" | col(16) }} {{ \"handler\" | col(10) }} {{ \"kind\" | col(10) }} {{ \"source\" | col(40) }} datastore[/dim]\n{% for e in entries %} [pack-name]{{ e.pack | col(16) }}[/pack-name] [handler-symbol]{{ e.handler | col(10) }}[/handler-symbol] [description]{{ e.kind | col(10) }}[/description] {{ e.source | col(40) }} [dim]{{ e.datastore }}[/dim]\n{% endfor %}{% else %} [dim](nothing deployed \u{2014} run `dodot up` first)[/dim]\n{% endif %}\n{%- elif kind == \"show-data-dir\" -%}\n[header]Data directory[/header]\n [dim]root:[/dim] {{ data_dir }}\n [dim]nodes:[/dim] {{ total_nodes }} [dim]size:[/dim] {{ total_size }} B\n\n{% for line in lines %}{{ line.prefix }}{{ line.name }}{% if line.annotation %} [dim]{{ line.annotation }}[/dim]{% endif %}\n{% endfor %}\n{%- elif kind == \"shell-init\" -%}\n[header]Shell-init profile[/header]\n{% if stale %} [warning]warning:[/warning] this profile was captured at {{ profile_when }} \u{2014} before\n your most recent `dodot up` at {{ last_up_when }}. Open a new\n shell to capture a fresh profile.\n\n{% endif %}{% if has_profile %} [dim]run:[/dim] {{ filename }}\n [dim]shell:[/dim] {{ shell }}\n\n{% for g in groups %} [pack-name]{{ g.pack }}[/pack-name] [description]/[/description] [handler-symbol]{{ g.handler }}[/handler-symbol] [dim]({{ g.group_total_label }})[/dim]\n{% for r in g.rows %} {{ r.target | col(36) }} [{{ r.status_class }}]{{ r.duration_label | col(10) }}[/{{ r.status_class }}]{% if r.exit_status != 0 %} [error]exit {{ r.exit_status }}[/error]{% endif %}\n{% endfor %}{% endfor %}\n [dim]\u{2500}\u{2500}[/dim]\n user-sourced total [deployed]{{ user_total_us }} \u{b5}s[/deployed]\n dodot framing [dim]{{ framing_us }} \u{b5}s[/dim]\n grand total [header]{{ total_us }} \u{b5}s[/header]\n{% else %}{% if profiling_enabled %} [dim](no profile yet \u{2014} open a new shell that sources `dodot-init.sh`,[/dim]\n [dim] then re-run `dodot probe shell-init`)[/dim]\n{% else %} [dim](profiling is disabled in config \u{2014} set [profiling] enabled = true,[/dim]\n [dim] run `dodot up`, then start a new shell)[/dim]\n{% endif %}{% endif %}\n [dim]profiles dir:[/dim] {{ profiles_dir }}\n [dim]for intra-file profiling, see `zprof` (zsh) or PS4 tracing (bash).[/dim]\n{%- elif kind == \"shell-init-aggregate\" -%}\n[header]Shell-init aggregate[/header]\n{% if stale %} [warning]warning:[/warning] the most recent run was captured at {{ latest_profile_when }} \u{2014}\n before your most recent `dodot up` at {{ last_up_when }}. Open\n a new shell to capture a fresh profile.\n\n{% endif %} [dim]runs:[/dim] {{ runs }}{% if runs != requested_runs %} [warning](requested {{ requested_runs }})[/warning]{% endif %}\n\n{% if rows %} [dim]{{ \"pack\" | col(14) }} {{ \"handler\" | col(8) }} {{ \"target\" | col(28) }} {{ \"p50\" | col(10) }} {{ \"p95\" | col(10) }} {{ \"max\" | col(10) }} runs[/dim]\n{% for r in rows %} [pack-name]{{ r.pack | col(14) }}[/pack-name] [handler-symbol]{{ r.handler | col(8) }}[/handler-symbol] {{ r.target | col(28) }} [deployed]{{ r.p50_label | col(10) }}[/deployed] {{ r.p95_label | col(10) }} {{ r.max_label | col(10) }} [dim]{{ r.seen_label }}[/dim]\n{% endfor %}{% else %}{% if profiling_enabled %} [dim](no profiles yet \u{2014} open a few shells that source `dodot-init.sh`,[/dim]\n [dim] then re-run with `--runs N`)[/dim]\n{% else %} [dim](profiling is disabled in config \u{2014} set [profiling] enabled = true,[/dim]\n [dim] run `dodot up`, then start a new shell)[/dim]\n{% endif %}{% endif %}\n [dim]profiles dir:[/dim] {{ profiles_dir }}\n{%- elif kind == \"shell-init-errors\" -%}\n[header]Shell-init errors[/header]\n{% if stale %} [warning]warning:[/warning] the most recent run was captured at {{ latest_profile_when }} \u{2014}\n before your most recent `dodot up` at {{ last_up_when }}. Open\n a new shell to capture a fresh profile.\n\n{% endif %} [dim]examined:[/dim] {{ runs_examined }} run{% if runs_examined != 1 %}s{% endif %}\n\n{% if targets %}{% for t in targets %} [pack-name]{{ t.pack }}[/pack-name] [description]/[/description] [handler-symbol]{{ t.handler }}[/handler-symbol] [dim]/[/dim] {{ t.display_target }} [error]({{ t.failure_count }} failed)[/error]\n [dim]{{ t.target }}[/dim]\n{% for r in t.runs %} {{ r.when | col(18) }} [error]{{ r.duration_label | col(10) }}[/error] [error]exit {{ r.exit_status }}[/error]\n{% for line in r.stderr_lines %} [dim]>[/dim] [error]{{ line }}[/error]\n{% endfor %}{% endfor %}\n{% endfor %}{% else %} [deployed](no failed sources in the last {{ runs_examined }} run{% if runs_examined != 1 %}s{% endif %})[/deployed]\n{% endif %} [dim]profiles dir:[/dim] {{ profiles_dir }}\n{%- elif kind == \"shell-init-filter\" -%}\n[header]Shell-init filter[/header] [pack-name]{{ filter }}[/pack-name]\n{% if stale %} [warning]warning:[/warning] the most recent run was captured at {{ latest_profile_when }} \u{2014}\n before your most recent `dodot up` at {{ last_up_when }}. Open\n a new shell to capture a fresh profile.\n\n{% endif %} [dim]examined:[/dim] {{ runs_examined }} run{% if runs_examined != 1 %}s{% endif %}\n\n{% if targets %}{% for t in targets %} [pack-name]{{ t.pack }}[/pack-name] [description]/[/description] [handler-symbol]{{ t.handler }}[/handler-symbol] [dim]/[/dim] {{ t.display_target }}{% if t.failure_count > 0 %} [error]({{ t.failure_count }} failed)[/error]{% endif %}\n [dim]{{ t.target }}[/dim]\n{% for r in t.runs %} {{ r.when | col(18) }} [{{ r.status_class }}]{{ r.duration_label | col(10) }}[/{{ r.status_class }}]{% if r.exit_status != 0 %} [error]exit {{ r.exit_status }}[/error]{% else %} [dim]exit 0[/dim]{% endif %}\n{% for line in r.stderr_lines %} [dim]>[/dim] [error]{{ line }}[/error]\n{% endfor %}{% endfor %}\n{% endfor %}{% else %} [dim](no entries matched `{{ filter }}` in the last {{ runs_examined }} run{% if runs_examined != 1 %}s{% endif %})[/dim]\n{% endif %} [dim]profiles dir:[/dim] {{ profiles_dir }}\n{%- elif kind == \"shell-init-history\" -%}\n[header]Shell-init history[/header]\n{% if stale %} [warning]warning:[/warning] the most recent run was captured at {{ latest_profile_when }} \u{2014}\n before your most recent `dodot up` at {{ last_up_when }}. Open\n a new shell to capture a fresh profile.\n\n{% endif %}\n{% if rows %} [dim]{{ \"when (UTC)\" | col(18) }} {{ \"shell\" | col(20) }} {{ \"total\" | col(10) }} {{ \"user\" | col(10) }} {{ \"entries\" | col(8) }} fail[/dim]\n{% for r in rows %} {{ r.when | col(18) }} {{ r.shell | col(20) }} [deployed]{{ r.total_label | col(10) }}[/deployed] {{ r.user_total_label | col(10) }} {{ r.entry_count | string | col(8) }} {% if r.failed_entries > 0 %}[error]{{ r.failed_entries }}[/error]{% else %}[dim]0[/dim]{% endif %}\n{% endfor %}{% else %}{% if profiling_enabled %} [dim](no profiles yet \u{2014} open a shell that sources `dodot-init.sh`)[/dim]\n{% else %} [dim](profiling is disabled in config \u{2014} set [profiling] enabled = true,[/dim]\n [dim] run `dodot up`, then start a new shell)[/dim]\n{% endif %}{% endif %}\n [dim]profiles dir:[/dim] {{ profiles_dir }}\n{%- elif kind == \"app\" -%}\n[header]App-support probe: [pack-name]{{ pack }}[/pack-name][/header]\n{% if not macos %} [dim](non-macOS host \u{2014} brew/Spotlight metadata not available; folder existence reflects collapsed app_support_dir)[/dim]\n{% endif %}{% if entries %}{% for e in entries %} [filename]{{ e.folder }}[/filename] [dim]({{ e.source_rule }})[/dim] {{ e.target_path }} {% if e.target_exists %}[deployed][exists][/deployed]{% else %}[warning][missing][/warning]{% endif %}\n{% if e.cask %} cask: [filename]{{ e.cask }}[/filename] [dim](installed)[/dim]\n{% endif %}{% if e.app_bundle %} app: [dim]/Applications/{{ e.app_bundle }}[/dim]\n{% endif %}{% if e.bundle_id %} bundle: [dim]{{ e.bundle_id }}[/dim]\n{% endif %}{% endfor %}{% else %} [dim](pack has no `_app/`, `force_app`, or `app_aliases` entries)[/dim]\n{% endif %}{% if suggested_adoptions %}\n[header]Suggested sibling adoptions[/header] [dim](from cask zap)[/dim]\n{% for s in suggested_adoptions %} [dim]{{ s }}[/dim]\n{% endfor %}{% endif %}\n{%- endif -%}\n";Expand description
Probe — deployment map, data-dir tree, summary. Branches on the
kind field of the serialized result.