List all known interface (program) URIs.
If a search term is given, only URIs containing that string are shown (case insensitive).
Inheritance: CliCommand
Example #1
0
        /// <inheritdoc/>
        protected override ExitCode ExecuteHelper(IEnumerable<FeedUri> interfaces, FeedReference source, Stability suggestedStabilityPolicy)
        {
            #region Sanity checks
            if (interfaces == null) throw new ArgumentNullException(nameof(interfaces));
            if (source == null) throw new ArgumentNullException(nameof(source));
            #endregion

            var modifiedInterfaces = new List<FeedUri>();
            foreach (var interfaceUri in interfaces)
            {
                var preferences = InterfacePreferences.LoadFor(interfaceUri);
                if (preferences.Feeds.AddIfNew(source))
                    modifiedInterfaces.Add(interfaceUri);

                var effectiveStabilityPolicy = (preferences.StabilityPolicy == Stability.Unset)
                    ? (Config.HelpWithTesting ? Stability.Testing : Stability.Stable)
                    : preferences.StabilityPolicy;
                if (effectiveStabilityPolicy < suggestedStabilityPolicy)
                {
                    string stabilityMessage = string.Format(Resources.StabilityPolicySingleImplementation, suggestedStabilityPolicy);
                    if (Handler.Ask(
                        stabilityMessage + Environment.NewLine + string.Format(Resources.StabilityPolicyAutoSet, interfaceUri.ToStringRfc()),
                        defaultAnswer: false, alternateMessage: stabilityMessage))
                        preferences.StabilityPolicy = suggestedStabilityPolicy;
                }
                preferences.SaveFor(interfaceUri);
            }

            if (modifiedInterfaces.Count == 0)
            {
                Handler.OutputLow(Resources.FeedManagement, Resources.FeedAlreadyRegistered);
                return ExitCode.NoChanges;
            }
            else
            {
                Handler.OutputLow(Resources.FeedManagement,
                    Resources.FeedRegistered + Environment.NewLine +
                    StringUtils.Join(Environment.NewLine, modifiedInterfaces.Select(x => x.ToStringRfc())));
                return ExitCode.OK;
            }
        }
Example #2
0
        /// <inheritdoc/>
        protected override ExitCode ExecuteHelper(IEnumerable<FeedUri> interfaces, FeedReference source, Stability suggestedStabilityPolicy)
        {
            #region Sanity checks
            if (interfaces == null) throw new ArgumentNullException(nameof(interfaces));
            if (source == null) throw new ArgumentNullException(nameof(source));
            #endregion

            var modifiedInterfaces = new List<FeedUri>();
            foreach (var interfaceUri in interfaces)
            {
                var preferences = InterfacePreferences.LoadFor(interfaceUri);
                if (preferences.Feeds.Remove(source))
                {
                    modifiedInterfaces.Add(interfaceUri);
                    if (preferences.StabilityPolicy == suggestedStabilityPolicy && suggestedStabilityPolicy != Stability.Unset)
                    {
                        if (Handler.Ask(string.Format(Resources.StabilityPolicyReset, interfaceUri.ToStringRfc()), defaultAnswer: false))
                            preferences.StabilityPolicy = Stability.Unset;
                    }
                    preferences.SaveFor(interfaceUri);
                }
            }

            if (modifiedInterfaces.Count == 0)
            {
                Handler.OutputLow(Resources.FeedManagement, Resources.FeedNotRegistered);
                return ExitCode.NoChanges;
            }
            else
            {
                Handler.OutputLow(Resources.FeedManagement,
                    Resources.FeedUnregistered + Environment.NewLine +
                    StringUtils.Join(Environment.NewLine, modifiedInterfaces.Select(x => x.ToStringRfc())));
                return ExitCode.OK;
            }
        }
Example #3
0
        private IEnumerable<ImplementationSelection> SolveAll(IEnumerable<Requirements> targets)
        {
            FeedManager.Refresh = true;

            // Run solver for each app
            var implementations = new List<ImplementationSelection>();
            foreach (var requirements in targets)
            {
                Log.Info("Solving for " + requirements);
                implementations.AddRange(Solver.Solve(requirements).Implementations);
            }

            // Deduplicate selections
            return implementations.Distinct(ManifestDigestPartialEqualityComparer<ImplementationSelection>.Instance);
        }
Example #4
0
        private void LoadImplementationDirs()
        {
            // List all implementation dirs in list box
            _systemImplDirs = StoreFactory.GetImplementationDirs().ToList();
            listBoxImplDirs.Items.Clear();
            listBoxImplDirs.Items.AddRange(_systemImplDirs.Cast<object>().ToArray());

            // Then remove user-specific entries from the backing list to prevent modification
            string userConfigPath = Locations.GetSaveConfigPath("0install.net", true, "injector", "implementation-dirs");
            if (File.Exists(userConfigPath))
                _systemImplDirs.RemoveRange(StoreFactory.GetCustomImplementationDirs(userConfigPath));
        }
Example #5
0
        private void LoadImplementationDirs()
        {
            var allImplDirs = StoreConfig.GetImplementationDirs().ToList();
            listBoxImplDirs.Items.AddRange(allImplDirs.Cast<object>().ToArray());

            var userImplDirs = StoreConfig.GetUserImplementationDirs();
            _lockedImplDirs = allImplDirs.Except(userImplDirs).ToList();
        }