Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ivorpad/mercadona-cli/llms.txt

Use this file to discover all available pages before exploring further.

Three flags are accepted by every Mercadona CLI command and can appear anywhere after the subcommand name — before or after positional arguments. This is by design: placing --max or --json at the end of a long command line works reliably, and safety flags like --max are never silently dropped.

Global Flags

FlagDefaultDescription
--wh <code>config [defaults].warehouse, else mad1Warehouse code. Product IDs and prices are per-warehouse.
--lang <code>config [defaults].lang, else esLanguage for product names and API responses. Options: es, en, ca, eu, vai.
--jsonfalseEmit data as raw JSON to stdout. Logs and errors always go to stderr.

Flag Position Flexibility

Flags can appear before positional arguments, after them, or mixed in between. All of the following are equivalent:
mercadona cart add 51110 2 --max 80 --json
mercadona cart add --max 80 51110 2 --json
mercadona cart add --json 51110 2 --max 80
This behaviour is intentional. The CLI reorders flags ahead of positional arguments internally before parsing, so --max cannot be silently ignored if placed after product IDs or quantities. This matters for safety: a misplaced --max in a script would otherwise be dropped without warning.

Exit Codes

CodeMeaning
0Success
1Error (authentication failure, budget exceeded, API error, invalid args)
2Usage error (unknown command, missing required argument)

Output Routing

All Mercadona CLI commands follow a strict output routing convention:
  • stdout — command output (human-readable summaries, or JSON when --json is set)
  • stderr — logs, progress messages, warnings, and error messages
This makes the CLI safe to pipe. For example:
mercadona search queso --json | jq '.hits[0].id'
works correctly because warnings and progress messages never appear on stdout to corrupt the JSON stream.

Warehouse Code Precedence

The active warehouse is resolved in this order:
  1. --wh <code> flag on the current command
  2. [defaults].warehouse in ~/.mercadona/config.toml (set by set-postal or import-har)
  3. Built-in default: mad1

Language Code Precedence

The active language is resolved in the same order:
  1. --lang <code> flag on the current command
  2. [defaults].lang in ~/.mercadona/config.toml (set by import-har when a language is detected in the session)
  3. Built-in default: es
mercadona version prints the build version. mercadona help or mercadona --help prints the full command usage summary with all available subcommands.

Build docs developers (and LLMs) love