Skip to content

Conversation

florelis
Copy link
Member

@florelis florelis commented Dec 2, 2022

This change adds an empty pin command. Actual implementation of the command will come as a separate PR. This change includes:

  • Definition of the pin command and its sub-commands add, remove, list, reset. These definitions contain only the definition of arguments but are missing the actual execution code.
  • A new experimental feature flag to hide this command.
  • All the help resource strings for the command. Still pending all the resources that will be shown during actual execution.
  • Adds a source ls alias for the source list command.
  • Changes an existing string to make it consistent with the rest.
Microsoft Reviewers: Open in CodeFlow

@florelis florelis requested a review from a team as a code owner December 2, 2022 00:16
@florelis
Copy link
Member Author

florelis commented Dec 2, 2022

Related to #476 and #2611 but does not resolve them yet

@@ -1357,7 +1357,8 @@ Please specify one of them using the `--source` option to proceed.</value>
<value>Portable install failed; Cleaning up...</value>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really want to sort this file alphabetically but I know VS is just going to mess it up again...

@denelon

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@Trenly
Copy link
Contributor

Trenly commented Dec 2, 2022

@jsoref

@jsoref
Copy link
Contributor

jsoref commented Dec 3, 2022

@Trenly: interesting, when I tested it, I got a very different result: check-spelling-sandbox#2 (comment) (this comment has since been collapsed, but you can expand it).

From looking at the logs (here and there), I suspect that checkout-merge step is not doing the right thing tm.

Here'a a rebased run:

https://github.com/check-spelling/winget-cli/pull/2/files#file-src-powershell-microsoft-winget-client-examples-sample_findpackage-ps1-L4

And here's me trying to reproduce this PR as it was:
check-spelling-sandbox#3

I'm going to have to investigate the checkout-merge logic, it feels like it isn't quite behaving.

Can I ask that this be rebased after #2739 is merged? (Preferably squashing 74a97e6 into 1ede614 -- when I did a rebase, I tripped on a conflict there...)

@github-actions

This comment has been minimized.

@florelis
Copy link
Member Author

florelis commented Dec 5, 2022

Thanks for looking into this @jsoref !

Can I ask that this be rebased after #2739 is merged?

Rebased. Looks like it found one unrecognized word but I'm not planning on merging it with that line so I'll leave it like this for now.

doc/Settings.md Outdated

### pinning

This feature enables the ability to pin packages to a specific version to prevent the Windows Package Manager from updating them.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it does not have to be a specific version

@@ -37,7 +37,7 @@ namespace AppInstaller::CLI

struct SourceListCommand final : public Command
{
SourceListCommand(std::string_view parent) : Command("list", { "ls" }, parent) {}
SourceListCommand(std::string_view parent) : Command("list", parent) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this actually remove the "ls" change done in previous pr during merging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I messed up the rebase. I'll revert this.

Argument::ForType(Args::Type::Source),
Argument::ForType(Args::Type::CustomHeader),
Argument::ForType(Args::Type::AcceptSourceAgreements),
Argument::ForType(Args::Type::Force),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious what is the scenario for --force in pin add?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scenario I was thinking of is overwriting the pin. Like winget pin add Pkg adds a pin, then winget pin add Pkg --version 1.* would fail because it exists, but if you add --force, it overwrites it. But honestly, I just added it because it was in the spec and I was hoping you had a scenario in mind :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I guess I thought about it some time ago and now my memory does not serve me well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even more curious - should --force be added to the list of generic arguments (like --wait and --verbose-logs)? In the worst case, it doesn't change the behavior, and in most cases it will remove a few lines of code.

Argument::ForType(Args::Type::Exact),
Argument::ForType(Args::Type::CustomHeader),
Argument::ForType(Args::Type::AcceptSourceAgreements),
Argument::ForType(Args::Type::Force),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also curious what is the scenario for --force in pin remove here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, I added it because it was in the spec. I can remove it until/unless we have a use for it. The only idea that comes to mind is having the command work for single pins and needing --force if multiple pins match.

@florelis florelis merged commit 291651f into microsoft:master Dec 8, 2022
@florelis florelis deleted the pinningSkeleton branch December 8, 2022 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants