Ejemplo n.º 1
0
        public override int Execute()
        {
            FilePath manifestFile;

            try
            {
                manifestFile = string.IsNullOrWhiteSpace(_explicitManifestFile)
                   ? _toolManifestFinder.FindFirst()
                   : new FilePath(_explicitManifestFile);
            }
            catch (ToolManifestCannotBeFoundException e)
            {
                throw new GracefulException(new[]
                {
                    e.Message,
                    LocalizableStrings.NoManifestGuide
                },
                                            verboseMessages: new[] { e.VerboseMessage },
                                            isUserError: false);
            }

            _toolManifestEditor.Remove(manifestFile, _packageId);

            _reporter.WriteLine(
                string.Format(
                    LocalizableStrings.UninstallLocalToolSucceeded,
                    _packageId,
                    manifestFile.Value).Green());
            return(0);
        }
Ejemplo n.º 2
0
        public override int Execute()
        {
            (FilePath? manifestFileOptional, string warningMessage) =
                _toolManifestFinder.ExplicitManifestOrFindManifestContainPackageId(_explicitManifestFile, _packageId);

            if (!manifestFileOptional.HasValue)
            {
                throw new GracefulException(
                          new[] { string.Format(LocalizableStrings.NoManifestFileContainPackageId, _packageId) },
                          isUserError: false);
            }

            var manifestFile = manifestFileOptional.Value;

            _toolManifestEditor.Remove(manifestFile, _packageId);

            if (warningMessage != null)
            {
                _reporter.WriteLine(warningMessage.Yellow());
            }

            _reporter.WriteLine(
                string.Format(
                    LocalizableStrings.UninstallLocalToolSucceeded,
                    _packageId,
                    manifestFile.Value).Green());
            return(0);
        }
Ejemplo n.º 3
0
        public override int Execute()
        {
            var manifestFile = string.IsNullOrWhiteSpace(_explicitManifestFile)
                ? _toolManifestFinder.FindFirst()
                : new FilePath(_explicitManifestFile);

            _toolManifestEditor.Remove(manifestFile, _packageId);
            _reporter.WriteLine(
                string.Format(
                    LocalizableStrings.UninstallLocalToolSucceeded,
                    _packageId,
                    manifestFile.Value).Green());
            return(0);
        }