Skip to content

Make command line argument resolution simple and fully consistent #18

@algal

Description

@algal

One flaw in the fastmigrate UI right now, is that the logic governing the resolution of the values to use for db and the migrations is not completely consistent.

That is, the logic is not simply:

  • command-line arguments take precedence over config file values
  • config file values take precedence over default values.

Instead, the logic is

  • command-line arguments take precedence over config file values (unless those values equal the default values!)
  • config file values take precedence over default values.

The simpler alternative would be better.

The details of why we do it wrong are here:

"""Performs final value resolution for db and migrations.
.

Essentially, it is because we specify default values for command line arguments in the parameters of functions decorated by @call_parse, and we then distinguish between values provided by the CLI and values derived from defaults merely by guessing on the basis of the value itself.

Perhaps call_parse provides some way to give us more information, so we can know not only the value of an argument, but whether it was supplied by the user vs defaulted in the absence of a supplied value?

At the moment we mitigate this flaw with a docstring which warns users. But it would be nice to fix this properly.

This GH issue represents the work to fix this, so that the system might present the simpler, better, less error-prone interface to the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions