Skip to main content

migrate-script

Rewrites undatum calls in shell scripts, Makefiles, CI files, Markdown and pipeline YAML to the current command and option names. Old spellings keep working with a warning until 2.0; this command updates your scripts before then. See the migration guide for every change.

undatum migrate-script scripts/

Without --write it prints a unified diff and changes nothing. Places that need a person, such as ingest calls (the arguments of db load differ) or options the new command does not have, are listed on stderr with file and line.

undatum migrate-script scripts/ pipelines/ Makefile --write
undatum migrate-script . --check # CI: exit 1 while anything needs migrating

What it rewrites:

  • option spellings: --filetype → --format-in, --outtype / --output-format → --format-out, --n / --objects-limit → --limit, and --format → --format-out on commands where it chooses the output format;
  • --engine iterable → --engine python;
  • commands: profile → stats, document → doc, scheme FILE → schema FILE --format cerberus (--stype X becomes --format X);
  • pipeline YAML: command: profile / document, engine: iterable, and undatum lines in run: blocks.

Only real invocations are changed: text in quotes, comments, echo arguments and other programs' options stay as they are. The alias tables come from the CLI itself, so an option is renamed only for commands that accept the old spelling.

Keeping old spellings on purpose​

Some text shows the old commands on purpose: a migration table, or the page of a deprecated command. Mark it with a migrate-script: ignore comment, an HTML comment in Markdown or a # comment in scripts, Makefiles and YAML. Marked lines are neither rewritten nor reported, so --check passes.

MarkerLeaves alone
<!-- migrate-script: ignore --> on a line of its ownthe next block, after any blank lines: a fenced code block, or the lines up to the next blank line (a table, a paragraph, a group of commands)
# migrate-script: ignore or <!-- migrate-script: ignore --> at the end of a linethat line
<!-- migrate-script: ignore-start --> and <!-- migrate-script: ignore-end --> on lines of their owneverything between them, or to the end of the file without an ignore-end

The # and the HTML form work in every file. A table that lists old and new commands side by side:

<!-- migrate-script: ignore -->
| Deprecated | Use instead |
|------------|-------------|
| `undatum profile FILE` | `undatum stats FILE` |

A single line in a script:

undatum profile data.csv # migrate-script: ignore

Reference​

Reads: shell scripts, Makefiles, Markdown and pipeline YAML (text files) · Writes: a diff, or the rewritten files with --write · Memory: one file at a time · Engines: python

undatum migrate-script [OPTIONS] PATHS...
ArgumentDescription
PATHS...Scripts, pipeline YAML, Makefiles or directories to scan. (required)
OptionDescriptionDefault
--writeRewrite the files in place (default: show a diff).
--checkExit with 1 when a file needs changes or review (for CI).

See also shared options.