Choco: A way to remove sources without knowing their names

Created on 13 Feb 2018  Â·  11Comments  Â·  Source: chocolatey/choco

It would be nice if there was a direct way to remove sources we don't know the name of (something like, choco source remove all).

Example use case: You need to use a script to move a machine from one environment to the other, and you need to disable package sources associated with the old environment, without your script necessarily knowing what the original environment was. Simply removing all configured sources before adding the new ones is the ideal way to go.

0 - Backlog Enhancement Up For Grabs

All 11 comments

@joshuathornton862 thanks for adding that. I wanted to link where the original conversation took place, was that on gitter?

Sure! It was in #packaging on Slack on 2/12 and 2/13.

On Tue, Feb 20, 2018 at 10:29 AM, Rob Reynolds notifications@github.com
wrote:

@joshuathornton862 https://github.com/joshuathornton862 thanks for
adding that. I wanted to link where the original conversation took place,
was that on gitter?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/chocolatey/choco/issues/1493#issuecomment-367034537,
or mute the thread
https://github.com/notifications/unsubscribe-auth/Aiwqt3WhXw_h7ocUsn1S7ipPOuq0UShnks5tWvLngaJpZM4SD6iF
.

@ferventcoder I want to give a try to implement this. I am a new contributor to this repo. Any suggestions?

@renehernandez if I may make a suggestion...

On my stream I have recently been working on adding a new Export Command for Chocolatey, which walks through the process of getting started with the Chocolatey code base. This started on this stream here:

https://github.com/gep13-oss/live-streams/blob/master/README.md

And continued here:

https://github.com/gep13-oss/live-streams/blob/master/README.md

And in this stream, @ferventcoder and I went through a PR review of what was created:

https://github.com/gep13-oss/live-streams/blob/master/README.md

These could be a good place to get started.

Let me know if you have any questions.

I have already drafted the implementation for this. What is preferred for this feature:

  • choco source remove all or
  • choco source remove -n=all

@gep13 Also, I couldn't find a good example of how to test source removal in the solution. Any suggestions there?

@ferventcoder @gep13 Any suggestions to my previous comments?

Put in .bat or .cmd:

SET "choco=%systemdrive%\ProgramData\chocolatey\choco.exe"
for /f "tokens=1" %%i in ('%choco% source list') do %choco% source remove -name %%i

It would be nice if there was a direct way to remove sources we don't know the name of (something like, choco source remove all).

Example use case: You need to use a script to move a machine from one environment to the other, and you need to disable package sources associated with the old environment, without your script necessarily knowing what the original environment was. Simply removing all configured sources before adding the new ones is the ideal way to go.

Put in .bat or .cmd:

SET "choco=%systemdrive%\ProgramData\chocolatey\choco.exe"
for /f "tokens=1" %%i in ('%choco% source list') do %choco% source remove -name %%i

this feel more appropriate - choco source remove all

Was this page helpful?
0 / 5 - 0 ratings