Skip to content

Align the linux host-setup scripts onto 'name one action' instead of 'the last one given wins' #673

Description

@ptr727

All three scripts under host-setup/linux/ document their actions as:

Actions, the last one given wins, default --report:

and implement it by overwriting MODE in the arg loop:

-r | --report) MODE="report" ;;
-i | --install) MODE="install" ;;

That silently discards an intent. install-tools.sh --report --install installs a host the operator asked to look at first, and the run says nothing about the --report it dropped. The failure is quiet in the direction that matters: the discarded action is the safe one and the surviving action is the one that changes the host.

Refusing is the better answer, and it is cheap:

ACTIONS=()
-r | --report) ACTIONS+=(report) ;;
...
((${#ACTIONS[@]} <= 1)) || die "More than one action given (${ACTIONS[*]}), name one"

Nothing in the repo relies on last-wins. No documented example passes two actions, bootstrap.sh passes exactly one action per run_tool call, and no test asserts the behavior.

The new Windows tooling in host-setup/windows/ already refuses this way and documents Actions, name one. That started as a constraint, since a PowerShell param() block records which switches were given and not the order they came in, so last-wins is not expressible there. But the constraint produced the better behavior, which is why this is filed rather than recorded as a permanent divergence in the Windows README's differences table.

Scope: the three usage() heredocs and the three parse_args() bodies. Once done, the differences table row that currently reads "Actions, the last one given wins | Actions, name one" is deleted rather than kept.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions