stefan-hoeck / idris2-pack

BSD 3-Clause "New" or "Revised" License
96 stars 25 forks source link

[feature request] support `latest` switch for option -p #296

Open ohad opened 1 month ago

ohad commented 1 month ago

We can currently specify specific package collections using the -p option to pack. It would be nice to also support latest and fetch-latest as options, as we do for pack.toml files.

It might not be a huge thing to change, so even if you don't have the time to do it, feel free to sketch what needs changing and where. It might make a nice first-issue.

buzden commented 1 month ago

Well, latest:<branch> and fetch-latest:<branch> in pack.toml is a syntax for "dynamic" commits of a package, not a syntax for pack collections. latest in pack switch command is indeed used as the pack collection, but only during the fetching.

Am I right, that you would like to use all the newest versions of everything during pack -p fetch-latest build <whatever>? Have you tried using pack -p HEAD build <whatever> for that? Is this satisfactory for your expectations?

stefan-hoeck commented 1 month ago

I wonder if all of this could be solved by allowing two things:

1) Specifying the pack.toml to use as a command-line argument 2) Allowing pack.toml files to explicitly state the parent file from which they inherit their settings

Currently, the following hierarchy is established (stuff on the left-hand side takes precedence):

command-line options <- pack.toml in current dir <- ... pack.toml files in parent dirs ... <- $PACK_DIR/user/pack.toml

The current state is well suited when invoking pack at the command-line when already in the correct directory, but not when calling it from other processes, where we probably don't want to have the settings from the current directory. Implementing the new behavior should not be too hard, but we should try and make it backward compatible so we don't invalidate all existing setups.