{#if view && view.kind !== 'edit'}
{@const isTruncated = viewOutput.length > RESULT_PREVIEW_LIMIT && !expandedResult}
{#if view.kind === 'command' || viewOutput}
{#if view.kind === 'command'}$ {view.command}{viewOutput ? '\n' : ''}{/if}{isTruncated
? viewOutput.slice(0, RESULT_PREVIEW_LIMIT)
: viewOutput}
{/if}
{#if isTruncated}
{/if}
{#if view.kind === 'command' && view.exitCode != null && view.exitCode !== 0}
{$i18n.t('Exit code {{CODE}}', { CODE: view.exitCode })}
{/if}
{:else if view?.kind === 'edit'}
{#each view.files as file, idx (`${file.path}-${idx}`)}
{@const stats = diffStats(file.diff)}
{file.path}
{#if stats.additions}+{stats.additions}{/if}
{#if stats.deletions}−{stats.deletions}{/if}
{#if file.diff}
{/if}
{/each}
{#if isError && result}
{result}
{/if}
{:else if args}
{$i18n.t('Input')}
{#if parsedArgs}
{#each Object.entries(parsedArgs) as [key, value]}
{key}
{typeof value === 'object' ? JSON.stringify(value) : value}
{/each}
{:else}
{formatJSONString(
args
)}
{/if}
{/if}
{#if !view && isDone && result}
{$i18n.t('Output')}
{#if typeof parsedResult === 'object' && parsedResult !== null}
{JSON.stringify(
parsedResult,
null,
2
)}
{:else}
{@const resultStr = String(parsedResult)}
{@const isTruncated = resultStr.length > RESULT_PREVIEW_LIMIT && !expandedResult}
{isTruncated
? resultStr.slice(0, RESULT_PREVIEW_LIMIT)
: resultStr}
{#if isTruncated}
{/if}
{/if}
{/if}