-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for additional Nuget feeds #192
Comments
Thanks for bringing this up -- given the scope and complexity of your concerns (unless the NuGet package can handle them on its own) I'd hesitate to push too hard for this, but feel free to experiment and come back with what you think it could look like and we can discuss from there! |
Would a minimum viable change just be considered a sane MVP? Rather than supporting the whole Nuget config file, this allows for the similar behaviour as dotnet restore which takes a This MVP doesn't currently account for "Multiple sources can be provided by specifying this option multiple times.", but that's partially due to my lack of familiarity with this library to quickly implement it. diff --git a/src/LibYear/Command.cs b/src/LibYear/Command.cs
index 3a12b83..1a6a84d 100644
--- a/src/LibYear/Command.cs
+++ b/src/LibYear/Command.cs
@@ -25,5 +25,5 @@ public class Command : AsyncCommand<Settings>
}
private Func<StatusContext, Task<int>> Run(Settings settings)
- => async _ => await Factory.App(_console).Run(settings);
+ => async _ => await Factory.App(_console, settings).Run(settings);
}
\ No newline at end of file
diff --git a/src/LibYear/Factory.cs b/src/LibYear/Factory.cs
index 21fad6e..a59b2d1 100644
--- a/src/LibYear/Factory.cs
+++ b/src/LibYear/Factory.cs
@@ -8,17 +8,17 @@ namespace LibYear;
public static class Factory
{
- public static App App(IAnsiConsole console)
+ public static App App(IAnsiConsole console, Settings settings)
{
- var packageVersionChecker = new PackageVersionChecker(PackageMetadataResource());
+ var packageVersionChecker = new PackageVersionChecker(PackageMetadataResource(settings));
var fileSystem = new FileSystem();
var projectRetriever = new ProjectFileManager(fileSystem);
return new App(packageVersionChecker, projectRetriever, console);
}
- private static PackageMetadataResource PackageMetadataResource()
+ private static PackageMetadataResource PackageMetadataResource(Settings settings)
{
- var source = new PackageSource("https://api.nuget.org/v3/index.json");
+ var source = new PackageSource(settings.Source);
var provider = Repository.Provider.GetCoreV3();
var repo = new SourceRepository(source, provider);
return repo.GetResource<PackageMetadataResource>();
diff --git a/src/LibYear/Settings.cs b/src/LibYear/Settings.cs
index 3658a3d..3fe67ec 100644
--- a/src/LibYear/Settings.cs
+++ b/src/LibYear/Settings.cs
@@ -32,4 +32,8 @@ public class Settings : CommandSettings
[CommandOption("-r|--recursive")]
[Description("search recursively for all compatible files, even if one is found in a directory passed as an argument")]
public bool Recursive { get; set; }
+
+ [CommandOption("-s|--source")]
+ [Description("search recursively for all compatible files, even if one is found in a directory passed as an argument")]
+ public string Source { get; set; } = "https://api.nuget.org/v3/index.json";
}
\ No newline at end of file |
I like the command line option route! It seems like Maybe see what a new |
Story
As a engineer who utilises private feeds, I want to be able to scan internal packages, so that I am also conscious of drift from internal standards.
Current research done
At the moment it looks like the URL for api.nuget is hard coded, is it possible to have this project either utilise the package sources section of nuget.config file or at least an environment variable so that multiple feeds could be targetted?
I did a very quick look (and hope to look further tonight) and I think the main concerns I would have if you'd like me to contribute this would be:
nuget.config
file supported (eg, top level only, or is the first file found utilised)?<clear />
or is it just a case of "anything listed takes priority"?The text was updated successfully, but these errors were encountered: