Skip to content

Assigning priority weight on values to add to path-like variables #185

Description

@xdelaruelle

Coming from the need to make a value persist at first or last position of a path-like variable.

Priority weight is a solution often used when a given "stuff" can be obtained from multiple providers. Priority weight helps to select the primary provider. This solution is used for instance when dealing with package repositories to configure the repository that has the precedence over everything else when installing a system.

Applied to an environment variable domain, priority weight could help to determine what variable value to retain among multiple possibilities.

When using prepend-path and append-path commands, a --priority argument could be added to assign a priority weight to the value set.

  • Values with no specific priority weight set owns a default priority weight (default weight value to be defined)
  • For two values with same priority weight, lastly set will take the high ground
  • Priority weights help to determine the prepend value order and the append value order (with top priority prepend value holding first position and top priority append value holding last position)
setenv PATH /bin
prepend-path --priority 100 PATH /path/to/foo
prepend-path PATH /path/to/bar

In this example resulting PATH equals /path/to/foo:/path/to/bar:/bin.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions