Пример #1
0
        public ToolUpdateGlobalOrToolPathCommand(ParseResult parseResult,
                                                 CreateToolPackageStoresAndInstallerAndUninstaller createToolPackageStoreInstallerUninstaller = null,
                                                 CreateShellShimRepository createShellShimRepository = null,
                                                 IReporter reporter = null)
            : base(parseResult)
        {
            _packageId               = new PackageId(parseResult.ValueForArgument <string>(ToolUninstallCommandParser.PackageIdArgument));
            _configFilePath          = parseResult.ValueForOption <string>(ToolUpdateCommandParser.ConfigOption);
            _framework               = parseResult.ValueForOption <string>(ToolUpdateCommandParser.FrameworkOption);
            _additionalFeeds         = parseResult.ValueForOption <string[]>(ToolUpdateCommandParser.AddSourceOption);
            _packageVersion          = parseResult.ValueForOption <string>(ToolUpdateCommandParser.VersionOption);
            _global                  = parseResult.ValueForOption <bool>(ToolUpdateCommandParser.GlobalOption);
            _verbosity               = Enum.GetName(parseResult.ValueForOption <VerbosityOptions>(ToolUpdateCommandParser.VerbosityOption));
            _toolPath                = parseResult.ValueForOption <string>(ToolUpdateCommandParser.ToolPathOption);
            _forwardRestoreArguments = parseResult.OptionValuesToBeForwarded(ToolUpdateCommandParser.GetCommand());

            _createToolPackageStoreInstallerUninstaller = createToolPackageStoreInstallerUninstaller ??
                                                          ToolPackageFactory.CreateToolPackageStoresAndInstallerAndUninstaller;

            _createShellShimRepository =
                createShellShimRepository ?? ShellShimRepositoryFactory.CreateShellShimRepository;

            _reporter      = (reporter ?? Reporter.Output);
            _errorReporter = (reporter ?? Reporter.Error);
        }
Пример #2
0
        public void UpdateToolParserCanParseInteractiveRestoreOption()
        {
            var result =
                Parser.Instance.Parse(@"dotnet tool update -g console.test.app --interactive");

            result.OptionValuesToBeForwarded(ToolUpdateCommandParser.GetCommand()).Should().ContainSingle("--interactive");
        }
Пример #3
0
        public void UpdateToolParserCanParseIgnoreFailedSourcesOption()
        {
            var result =
                Parser.Instance.Parse(@"dotnet tool update -g console.test.app --ignore-failed-sources");

            result.OptionValuesToBeForwarded(ToolUpdateCommandParser.GetCommand()).Should().ContainSingle("--ignore-failed-sources");
        }
Пример #4
0
        public void UpdateToolParserCanParseDisableParallelOption()
        {
            var result =
                Parser.Instance.Parse(@"dotnet tool update -g console.test.app --disable-parallel");

            result.OptionValuesToBeForwarded(ToolUpdateCommandParser.GetCommand()).Should().ContainSingle("--disable-parallel");
        }
Пример #5
0
        public ToolUpdateLocalCommand(
            ParseResult parseResult,
            IToolPackageInstaller toolPackageInstaller       = null,
            IToolManifestFinder toolManifestFinder           = null,
            IToolManifestEditor toolManifestEditor           = null,
            ILocalToolsResolverCache localToolsResolverCache = null,
            IReporter reporter = null)
            : base(parseResult)
        {
            _packageId            = new PackageId(parseResult.GetValueForArgument(ToolUpdateCommandParser.PackageIdArgument));
            _explicitManifestFile = parseResult.GetValueForOption(ToolUpdateCommandParser.ToolManifestOption);

            _reporter = (reporter ?? Reporter.Output);

            if (toolPackageInstaller == null)
            {
                (IToolPackageStore,
                 IToolPackageStoreQuery,
                 IToolPackageInstaller installer)toolPackageStoresAndInstaller
                    = ToolPackageFactory.CreateToolPackageStoresAndInstaller(
                          additionalRestoreArguments: parseResult.OptionValuesToBeForwarded(ToolUpdateCommandParser.GetCommand()));
                _toolPackageInstaller = toolPackageStoresAndInstaller.installer;
            }
            else
            {
                _toolPackageInstaller = toolPackageInstaller;
            }

            _toolManifestFinder = toolManifestFinder ??
                                  new ToolManifestFinder(new DirectoryPath(Directory.GetCurrentDirectory()));
            _toolManifestEditor        = toolManifestEditor ?? new ToolManifestEditor();
            _localToolsResolverCache   = localToolsResolverCache ?? new LocalToolsResolverCache();
            _toolLocalPackageInstaller = new ToolInstallLocalInstaller(parseResult, toolPackageInstaller);
            _toolInstallLocalCommand   = new Lazy <ToolInstallLocalCommand>(
                () => new ToolInstallLocalCommand(
                    parseResult,
                    _toolPackageInstaller,
                    _toolManifestFinder,
                    _toolManifestEditor,
                    _localToolsResolverCache,
                    _reporter));
        }