All rules

Shell commands with and without a prompt

shell-prompt-mixon by default (info)Japanese / English

Shell commands written with a "$" prompt in some places and without in others

Example

Flagged
# Usage ```bash npm install chaffjs ``` ```bash npx chaffjs init ``` ```bash $ npx chaffjs README.md ```
What chaff prints
11:1 This block writes its commands with a prompt ($) differently from the other 2 blocks
Fixed
# Usage ```bash npm install chaffjs ``` ```bash npx chaffjs init ``` ```bash npx chaffjs README.md ```
What chaff prints
no finding
chaff.yaml used for this example
genre: docs/manual

How to fix

Match the majority. For commands meant to be copied, leaving the prompt out avoids pasting it.

Why it matters

When "$ npm install" and "npm install" both appear in one document, the reader wonders whether to type the "$", and a copied command may fail. chaff compares shell blocks (```bash, ```console) whose every line has a prompt ($) with those where no line has one, and points at the fewer. A block that shows a command with its output (some lines prompted, some not) is not read. Which way is right is not decided.

What it does not flag

Blocks in other languages or without a language, blocks that show a command with its output, and comment lines (#) are not read. When the fewer kind is more than {limit} blocks, it is taken as a choice.

Turning it off or relaxing it

Silence this one spot (in the document)
<!-- stet: shell-prompt-mix — reason -->
Relax it for the team (the reason is kept as a comment in chaff.yaml)
npx chaffjs relax shell-prompt-mix --why "reason"
Turn it off for the team (chaff.yaml)
rules: shell-prompt-mix: off
Technical details
Layer
L1
Status
stable
Severity
info
Languages
Japanese and English
Suited to
technical, docs, blog, legal, academic, literature, speech
Reads from the document
markdown

Levels

Set a level for this rule under rules in chaff.yaml. With nothing set, it runs at the level its genre gives it (see By genre below).

strictreported when the fewer style appears in 3 blocks or fewer
normalreported when the fewer style appears in 2 blocks or fewer
relaxedreported when the fewer style appears in 1 blocks or fewer

By genre

Runs by default in
technical/spec, technical/readme, blog/tech, blog/essay, blog/owned-media, docs/manual, docs/faq, docs/glossary
Turned off by the genre in
legal/contract, legal/statute, legal/judgment, legal/patent, academic/paper, literature/fiction, literature/essay, literature/poetry, literature/play, speech/address, speech/transcript
Not suited to, and not run in
business/proposal, business/report, business/email, business/press-release, business/meeting-notes

Genres

Message

This block writes its commands with a prompt ($) differently from the other {majority} blocks

Rewrite depth (chaff fix-plan --depth): light — words and sentences; the structure and the voice stay

This page is built from the rule's definition file:packages/chaff/rules/shell-prompt-mix.yaml