Master

Shipping a tool with every limit in one file

A tool ships when the numbers are inside the limits. The limits are one file, and one file is why a refusal can name the limit it broke.

What you will see

One line with the numbers. Written is what a change is compared against.

About 1 min of reading

Try It

Ship with named limits

1

Write the limits

printf 'files 500 depth 3 pairs 200 refusals 0\n' > /tmp/l.txt; wc -w < /tmp/l.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
8. Four names and four numbers is one file.
2

Compare name by name

printf 'refusals 0\nmax_refusals 0\n' | awk '{print ($1>$3) ? "breach refusals" : "ok refusals"}'

Before you run it, say out loud what it will print. Then open the answer.

What it prints
ok refusals. One comparison per limit is a separate line.
3

Write the shipped numbers

printf 'shipped version 4 files 412 pairs 96\n' >> /tmp/s.txt; tail -1 /tmp/s.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One line with the numbers. Written is what a change is compared against.

Data Flow

A report and limits to a ship
1 The limits are written as names and numbers
↓
2 The report is compared name by name
↓
3 Each breach is written as its own line
↓
4 The ship writes the numbers and the version
Why this works
Why a limit is never a default in code

A default in code is a limit nobody can read. A limit in a file is a limit that a refusal can name.

The one limit that is not a number

The set of subcommands that must have help. A set is a limit, and a leaf without help is a breach of that limit.

Examples

The limits are names and numbers

Files, depth, pairs, refusals. Names are what a refusal repeats, and a refusal that repeats is actionable.

The report is compared name by name

One comparison per limit. One per limit is what makes every breach a separate line.

The ship writes what it shipped with

The numbers and the version. Written is what a later change is compared against.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← A batch over many files as a queue with a point
Previous Lesson
A batch over many files as a queue with a point