From f5403694f3c18974d4c4cf072e1511793e3748ae Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Fri, 12 Jul 2024 17:26:56 +0800 Subject: [PATCH 1/2] feat: group options for update strategy and save strategy Signed-off-by: Frost Ming --- src/pdm/cli/options.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/pdm/cli/options.py b/src/pdm/cli/options.py index a052e0732d..362dc46511 100644 --- a/src/pdm/cli/options.py +++ b/src/pdm/cli/options.py @@ -288,35 +288,37 @@ def no_isolation_option( ) groups_group.options.append(dev_group) -save_strategy_group = ArgumentGroup("save_strategy", is_mutually_exclusive=True) -save_strategy_group.add_argument( +save_strategy_group = ArgumentGroup("Save Strategy") +_save_sub_group = ArgumentGroup("save_strategy", is_mutually_exclusive=True) +_save_sub_group.add_argument( "--save-compatible", action="store_const", dest="save_strategy", const="compatible", help="Save compatible version specifiers", ) -save_strategy_group.add_argument( +_save_sub_group.add_argument( "--save-wildcard", action="store_const", dest="save_strategy", const="wildcard", help="Save wildcard version specifiers", ) -save_strategy_group.add_argument( +_save_sub_group.add_argument( "--save-exact", action="store_const", dest="save_strategy", const="exact", help="Save exact version specifiers", ) -save_strategy_group.add_argument( +_save_sub_group.add_argument( "--save-minimum", action="store_const", dest="save_strategy", const="minimum", help="Save minimum version specifiers", ) +save_strategy_group.add_argument(_save_sub_group) skip_option = Option( "-k", @@ -330,35 +332,37 @@ def no_isolation_option( default=from_splitted_env("PDM_SKIP_HOOKS", ","), ) -update_strategy_group = ArgumentGroup("update_strategy", is_mutually_exclusive=True) -update_strategy_group.add_argument( +update_strategy_group = ArgumentGroup("Update Strategy") +_update_sub_group = ArgumentGroup("update_strategy", is_mutually_exclusive=True) +_update_sub_group.add_argument( "--update-reuse", action="store_const", dest="update_strategy", const="reuse", help="Reuse pinned versions already present in lock file if possible", ) -update_strategy_group.add_argument( +_update_sub_group.add_argument( "--update-eager", action="store_const", dest="update_strategy", const="eager", help="Try to update the packages and their dependencies recursively", ) -update_strategy_group.add_argument( +_update_sub_group.add_argument( "--update-all", action="store_const", dest="update_strategy", const="all", help="Update all dependencies and sub-dependencies", ) -update_strategy_group.add_argument( +_update_sub_group.add_argument( "--update-reuse-installed", action="store_const", dest="update_strategy", const="reuse-installed", help="Reuse installed packages if possible", ) +update_strategy_group.add_argument(_update_sub_group) project_option = Option( "-p", @@ -382,10 +386,6 @@ def no_isolation_option( clean_group.add_argument("--clean", action="store_true", help="Clean packages not in the lockfile") clean_group.add_argument("--only-keep", action="store_true", help="Only keep the selected packages") -sync_group = ArgumentGroup("sync", is_mutually_exclusive=True) -sync_group.add_argument("--sync", action="store_true", dest="sync", help="Sync packages") -sync_group.add_argument("--no-sync", action="store_false", dest="sync", help="Don't sync packages") - packages_group = ArgumentGroup("Package Arguments") packages_group.add_argument( "-e", From 1eba06684ae8f20d29956a45ce6c94923f660662 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Fri, 12 Jul 2024 17:30:57 +0800 Subject: [PATCH 2/2] add news Signed-off-by: Frost Ming --- news/3016.feature.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/3016.feature.md diff --git a/news/3016.feature.md b/news/3016.feature.md new file mode 100644 index 0000000000..1c097302f7 --- /dev/null +++ b/news/3016.feature.md @@ -0,0 +1 @@ +Group options for update strategy and save strategy.