public void AddApiTest_PropertyName()
        {
            var testFile = TestFiles.Doc;
            var now      = DateTime.Now.ToString("MM-dd-yyyy hh:mm:ss");

            var options = new AddOptions
            {
                FileInfo   = testFile.ToFileInfo(),
                Properties = new List <AddProperty>
                {
                    new AddProperty
                    {
                        Value          = now,
                        Type           = "DateTime",
                        SearchCriteria = new SearchCriteria
                        {
                            NameOptions = new NameOptions
                            {
                                Value = "print"
                            }
                        },
                    }
                }
            };

            var request = new AddRequest(options);

            var result = MetadataApi.Add(request);

            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result.Path);
            Assert.IsNotEmpty(result.Url);
            Assert.Greater(result.AddedCount, 0);
        }
コード例 #2
0
        public IEnumerable Handle(AddOptions c)
        {
            if (!Created)
            {
                throw new PollNotCreated();
            }
            if (c.User != Owner)
            {
                throw new UnauthorizedUser();
            }
            if (Ended)
            {
                throw new PollAlreadyEnded();
            }

            var uniqueOptions = c.Options.Distinct().Except(Options).ToList();

            if (uniqueOptions.Count == 0)
            {
                throw new NoOptionAdded();
            }

            yield return(new OptionsAdded
            {
                Id = c.Id,
                Options = uniqueOptions
            });
        }
        public void AddApiTest_UnsupportedFormat()
        {
            var testFile = TestFiles.Json;
            var options  = new AddOptions
            {
                FileInfo   = testFile.ToFileInfo(),
                Properties = new List <AddProperty>
                {
                    new AddProperty
                    {
                        SearchCriteria = new SearchCriteriaWithoutValue
                        {
                            TagOptions = new TagOptions
                            {
                                ExactTag = new Tag
                                {
                                    Name     = "Creator",
                                    Category = "Person"
                                }
                            }
                        },
                        Value = "New Value",
                        Type  = "String"
                    }
                }
            };

            var request = new AddRequest(options);

            var ex = Assert.Throws <ApiException>(() => { MetadataApi.Add(request); });

            Assert.AreEqual($"The specified file '{testFile.FullName}' has type which is not currently supported.", ex.Message);
        }
        public void AddApiTest_FileNotFound()
        {
            var testFile = TestFiles.NotExist;
            var options  = new AddOptions
            {
                FileInfo   = testFile.ToFileInfo(),
                Properties = new List <AddProperty>
                {
                    new AddProperty
                    {
                        SearchCriteria = new SearchCriteriaWithoutValue
                        {
                            TagOptions = new TagOptions
                            {
                                ExactTag = new Tag
                                {
                                    Name     = "Creator",
                                    Category = "Person"
                                }
                            }
                        },
                        Value = "New Value",
                        Type  = "String"
                    }
                }
            };

            var request = new AddRequest(options);

            var ex = Assert.Throws <ApiException>(() => { MetadataApi.Add(request); });

            Assert.AreEqual($"Can't find file located at '{testFile.FullName}'.", ex.Message);
        }
        public void AddApiTestWrongValueTypeForTag()
        {
            var testFile = TestFiles.Docx;
            var options  = new AddOptions
            {
                FileInfo   = testFile.ToFileInfo(),
                Properties = new List <AddProperty>
                {
                    new AddProperty
                    {
                        SearchCriteria = new SearchCriteriaWithoutValue
                        {
                            TagOptions = new TagOptions
                            {
                                ExactTag = new Tag
                                {
                                    Name     = "Printed",
                                    Category = "Time"
                                }
                            }
                        },
                        Value = "New Value",
                        Type  = "String"
                    }
                }
            };

            var request = new AddRequest(options);

            var ex = Assert.Throws <ApiException>(() => { MetadataApi.Add(request); });

            Assert.AreEqual($"There are no changes in metadata.", ex.Message);
        }
コード例 #6
0
ファイル: KSP.cs プロジェクト: CodingWoes/CKAN
        private static int AddInstall(AddOptions options)
        {
            if (options.name == null || options.path == null)
            {
                User.WriteLine("add <name> <path> - argument missing, perhaps you forgot it?");
                return(Exit.BADOPT);
            }

            if (KSPManager.Instances.ContainsKey(options.name))
            {
                User.WriteLine("Install with name \"{0}\" already exists, aborting..", options.name);
                return(Exit.BADOPT);
            }

            try
            {
                KSPManager.AddInstance(options.name, options.path);
                User.WriteLine("Added \"{0}\" with root \"{1}\" to known installs", options.name, options.path);
                return(Exit.OK);
            }
            catch (NotKSPDirKraken ex)
            {
                User.WriteLine("Sorry, {0} does not appear to be a KSP directory", ex.path);
                return(Exit.BADOPT);
            }
        }
コード例 #7
0
        public static bool ValidateFcntSettings(AddOptions opts, string fCntUpStartReportedString, string fCntDownStartReportedString, string fCntResetCounterReportedString)
        {
            var isValid = true;

            var abpRelaxMode = string.IsNullOrEmpty(opts.ABPRelaxMode) ||
                               string.Equals(opts.ABPRelaxMode, "1", StringComparison.OrdinalIgnoreCase) ||
                               string.Equals(opts.ABPRelaxMode, "true", StringComparison.OrdinalIgnoreCase);

            var fCntUpStart      = ConvertToUIntProperty(opts.FCntUpStart);
            var fCntDownStart    = ConvertToUIntProperty(opts.FCntDownStart);
            var fCntResetCounter = ConvertToUIntProperty(opts.FCntResetCounter);

            var fCntUpStartReported      = ConvertToUIntProperty(fCntUpStartReportedString);
            var fCntDownStartReported    = ConvertToUIntProperty(fCntDownStartReportedString);
            var fCntResetCounterReported = ConvertToUIntProperty(fCntResetCounterReportedString);

            // AbpRelaxMode FALSE
            if (!abpRelaxMode)
            {
                isValid &= ValidateSingleFcnt(fCntUpStart, fCntUpStartReported, fCntResetCounter, fCntResetCounterReported, "FCntUpStart");
                isValid &= ValidateSingleFcnt(fCntDownStart, fCntDownStartReported, fCntResetCounter, fCntResetCounterReported, "FCntDownStart");
            }

            return(isValid);
        }
コード例 #8
0
        public void It_should_run_and_update_a_FeatureBit_if_it_already_exists_and_force_is_specified()
        {
            // Arrange
            var sb = new StringBuilder();

            SystemContext.ConsoleWriteLine = s => sb.Append(s);
            var opts = new AddOptions {
                Name = "foo", Force = true
            };
            var repo = Substitute.For <IFeatureBitsRepo>();

            repo.AddAsync(Arg.Any <IFeatureBitDefinition>()).Returns <Task <IFeatureBitDefinition> >(x => throw new DataException("Cannot add. Feature bit with name 'foo' already exists."));

            int counter = 0;

            repo.When(x => x.UpdateAsync(Arg.Any <IFeatureBitDefinition>())).Do((x => counter++));

            var it = new AddCommand(opts, repo);

            // Act
            var result = it.RunAsync().Result;

            // Assert
            sb.ToString().Should().Be("Feature bit updated.");
            result.Should().Be(0);
            counter.Should().Be(1);
        }
コード例 #9
0
        public virtual ExecutionResult Add(AddOptions options)
        {
            var result     = new ExecutionResult("perform add operation", options);
            var stepResult = _commander.GoToIndexPage();

            result.ExecutionResultSteps.Add(
                ExecutionResultStep.Build(stepResult ? ExecutionStatus.Passed : ExecutionStatus.Failed,
                                          "Go to index page " + (stepResult ? "PASS" : "FAILED")));
            if (!stepResult)
            {
                return(result);
            }

            stepResult = _commander.SetElementText("x", options.X);
            result.ExecutionResultSteps.Add(
                ExecutionResultStep.Build(stepResult ? ExecutionStatus.Passed : ExecutionStatus.Failed,
                                          "Set X inbox value: " + (stepResult ? "PASS" : "FAILED")));
            if (!stepResult)
            {
                return(result);
            }


            stepResult = _commander.SetElementText("y", options.Y);
            result.ExecutionResultSteps.Add(
                ExecutionResultStep.Build(stepResult ? ExecutionStatus.Passed : ExecutionStatus.Failed,
                                          "Set Y inbox value: " + (stepResult ? "PASS" : "FAILED")));

            stepResult = _commander.Click("add");
            result.ExecutionResultSteps.Add(
                ExecutionResultStep.Build(stepResult ? ExecutionStatus.Passed : ExecutionStatus.Failed,
                                          "Click Add button: " + (stepResult ? "PASS" : "FAILED")));

            return(result);
        }
コード例 #10
0
        private static async Task <bool> RunAddAndReturnExitCode(AddOptions opts)
        {
            if (!configurationHelper.ReadConfig())
            {
                return(false);
            }

            bool isSuccess = false;

            opts = iotDeviceHelper.CleanOptions(opts as object, true) as AddOptions;
            opts = iotDeviceHelper.CompleteMissingAddOptions(opts, configurationHelper);

            if (iotDeviceHelper.VerifyDevice(opts, null, null, null, configurationHelper, true))
            {
                Twin twin = iotDeviceHelper.CreateDeviceTwin(opts);
                isSuccess = await iotDeviceHelper.WriteDeviceTwin(twin, opts.DevEui, configurationHelper, true);
            }
            else
            {
                StatusConsole.WriteLogLine(MessageType.Error, $"Can not add {opts.Type.ToUpper()} device.");
            }

            if (isSuccess)
            {
                var twin = await iotDeviceHelper.QueryDeviceTwin(opts.DevEui, configurationHelper);

                StatusConsole.WriteTwin(opts.DevEui, twin);
            }

            return(isSuccess);
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: richardbmx/Evolution
        private static int Run(AddOptions options)
        {
            PopulateMissingConfigValues(ref options);
            var app = DependencyRegistry.GetApplication(options);

            return(app.Run(options));
        }
コード例 #12
0
        private static void RegisterAddSubcommand(CommandLineApplication packagesCmd, ReportsFactory reportsFactory)
        {
            packagesCmd.Command("add", c =>
            {
                c.Description = "Add a NuGet package to the specified packages folder";
                var argNupkg  = c.Argument("[nupkg]", "Path to a NuGet package");
                var argSource = c.Argument("[source]", "Path to packages folder");
                c.HelpOption("-?|-h|--help");

                c.OnExecute(async() =>
                {
                    c.ShowRootCommandFullNameAndVersion();

                    var options = new AddOptions
                    {
                        Reports        = reportsFactory.CreateReports(quiet: false),
                        SourcePackages = argSource.Value,
                        NuGetPackage   = argNupkg.Value
                    };
                    var command = new Packages.AddCommand(options);
                    var success = await command.Execute();
                    return(success ? 0 : 1);
                });
            });
        }
コード例 #13
0
        private int AddInstall(AddOptions options)
        {
            if (options.name == null || options.path == null)
            {
                User.RaiseMessage("add <name> <path> - argument missing, perhaps you forgot it?");
                return(Exit.BADOPT);
            }

            if (Manager.HasInstance(options.name))
            {
                User.RaiseMessage("Install with name \"{0}\" already exists, aborting..", options.name);
                return(Exit.BADOPT);
            }

            try
            {
                string path = options.path;
                Manager.AddInstance(new CKAN.KSP(path, options.name, User));
                User.RaiseMessage("Added \"{0}\" with root \"{1}\" to known installs", options.name, options.path);
                return(Exit.OK);
            }
            catch (NotKSPDirKraken ex)
            {
                User.RaiseMessage("Sorry, {0} does not appear to be a KSP directory", ex.path);
                return(Exit.BADOPT);
            }
        }
コード例 #14
0
        private static int HandleAdd(IJournalrService service, AddOptions opts)
        {
            var datetime = new Chronic.Parser().Parse(opts.DateTime ?? "now").Start;

            if (datetime == null)
            {
                Console.WriteLine($"Could not parse {opts.DateTime}");
                return(1);
            }

            var entry = new Entry {
                EntryId = GenerateId(), Text = opts.Body, EntryDate = datetime.Value, CreatedDate = DateTime.Now, Tags = string.IsNullOrWhiteSpace(opts.Tags) ? new List <string>() : opts.Tags.Split(',').ToList()
            };

            if (service.AddEntry(entry))
            {
                Console.WriteLine($"Added entry: { entry.EntryId }");
            }
            else
            {
                Console.WriteLine("Failed to add entry");
            }

            return(0);
        }
        public void AddApiTest()
        {
            var now      = DateTime.Now.ToString("MM-dd-yyyy hh:mm:ss");
            var testFile = TestFiles.Docx;
            var options  = new AddOptions
            {
                FileInfo   = testFile.ToFileInfo(),
                Properties = new List <AddProperty>
                {
                    new AddProperty
                    {
                        SearchCriteria = new SearchCriteriaWithoutValue
                        {
                            TagOptions = new TagOptions
                            {
                                ExactTag = new Tag
                                {
                                    Name     = "Printed",
                                    Category = "Time"
                                }
                            }
                        },
                        Value = now,
                        Type  = "DateTime"
                    }
                }
            };

            var request = new AddRequest(options);

            var result = MetadataApi.Add(request);

            Assert.IsNotNull(result);
            Assert.Greater(result.AddedCount, 0);
        }
コード例 #16
0
ファイル: CalculatorTestLogic.cs プロジェクト: saturn72/Titan
 public virtual IEnumerable <ExecutionResult> Add(AddOptions options)
 {
     return(new[]
     {
         _calculator.Add(options)
     });
 }
        public void AddApiTest_ValueFormatException()
        {
            var testFile = TestFiles.Jpg;
            var options  = new AddOptions
            {
                FileInfo   = testFile.ToFileInfo(),
                Properties = new List <AddProperty>
                {
                    new AddProperty
                    {
                        SearchCriteria = new SearchCriteriaWithoutValue
                        {
                            TagOptions = new TagOptions
                            {
                                ExactTag = new Tag
                                {
                                    Name     = "Printed",
                                    Category = "Time"
                                }
                            }
                        },
                        Value = "New Value",
                        Type  = "DateTime"
                    }
                }
            };

            var request = new AddRequest(options);
            var ex      = Assert.Throws <ApiException>(() => { MetadataApi.Add(request); });

            Assert.AreEqual(ex.Message, "Request parameters missing or have incorrect format");
        }
コード例 #18
0
        public void It_should_handle_OnOff_false()
        {
            // Arrange
            CommandFeatureBitDefintion def = null;
            var sb = new StringBuilder();

            SystemContext.ConsoleWriteLine = s => sb.Append(s);
            var bit = new CommandFeatureBitDefintion {
                Name = "foo", OnOff = false
            };
            var opts = new AddOptions {
                Name = "foo", OnOff = "false"
            };
            var repo = Substitute.For <IFeatureBitsRepo>();

            repo.AddAsync(Arg.Any <CommandFeatureBitDefintion>()).Returns(Task.FromResult((IFeatureBitDefinition)bit)).AndDoes(x =>
            {
                def = x.Arg <CommandFeatureBitDefintion>();
            });

            var it = new AddCommand(opts, repo);

            // Act
            var result = it.RunAsync().Result;

            // Assert
            result.Should().Be(0);
            sb.ToString().Should().Be("Feature bit added.");
            def.Should().NotBeNull();
            def.OnOff.Should().BeFalse();
        }
コード例 #19
0
        public void It_should_run_and_create_a_FeatureBit_when_the_onOff_bit_is_false()
        {
            // Arrange
            var sb = new StringBuilder();

            SystemContext.ConsoleWriteLine = s => sb.Append(s);
            var bit = new CommandFeatureBitDefintion {
                Name = "foo"
            };
            var opts = new AddOptions {
                Name = "foo"
            };
            var repo = Substitute.For <IFeatureBitsRepo>();

            repo.AddAsync(bit).Returns(Task.FromResult((IFeatureBitDefinition)bit));

            var it = new AddCommand(opts, repo);

            // Act
            var result = it.RunAsync().Result;

            // Assert
            result.Should().Be(0);
            sb.ToString().Should().Be("Feature bit added.");
        }
コード例 #20
0
        private static object RunAddAndReturnExitCode(AddOptions opts)
        {
            if (!configurationHelper.ReadConfig())
            {
                return(false);
            }

            bool isSuccess = false;

            opts = iotDeviceHelper.CleanOptions(opts as object, true) as AddOptions;
            opts = iotDeviceHelper.CompleteMissingAddOptions(opts, configurationHelper);

            if (iotDeviceHelper.VerifyDevice(opts, null, null, null, configurationHelper))
            {
                Twin twin = iotDeviceHelper.CreateDeviceTwin(opts);
                isSuccess = iotDeviceHelper.WriteDeviceTwin(twin, opts.DevEui, configurationHelper, true).Result;
            }
            else
            {
                StatusConsole.WriteLine(MessageType.Error, $"Can not add {opts.Type.ToUpper()} device.");
            }

            if (isSuccess)
            {
                var twin = iotDeviceHelper.QueryDeviceTwin(opts.DevEui, configurationHelper).Result;
                Console.WriteLine();
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine($"DevEUI: {opts.DevEui}");
                Console.WriteLine(TwinToString(twin));
                Console.ResetColor();
            }

            return(isSuccess);
        }
コード例 #21
0
        public void It_throws_if_the_repo_is_null()
        {
            var opts = new AddOptions();
            // ReSharper disable once ObjectCreationAsStatement
            Action act = () => { new AddCommand(opts, null); };

            act.Should().Throw <ArgumentNullException>();
        }
コード例 #22
0
        public void It_can_be_created()
        {
            var opts = new AddOptions();
            var repo = Substitute.For <IFeatureBitsRepo>();
            var it   = new AddCommand(opts, repo);

            it.Should().NotBeNull();
        }
コード例 #23
0
ファイル: Program.cs プロジェクト: sitwalkstand/featurebits
        private static async Task <int> RunAddAndReturnExitCode(AddOptions opts)
        {
            var repo   = GetCorrectRepository(opts);
            var cmd    = new AddCommand(opts, repo);
            int result = await cmd.RunAsync();

            return(result);
        }
コード例 #24
0
        static AddOptions GetDefaultAddOptions()
        {
            AddOptions options = new AddOptions();

            options.AddPrivateParents     = true;
            options.NeedCheckPlatformPath = true;
            return(options);
        }
コード例 #25
0
ファイル: Repo.cs プロジェクト: trakos/CFAN
        private int AddRepository(AddOptions options)
        {
            RegistryManager manager = Manager.CurrentInstance.RegistryManager;

            if (options.name == null)
            {
                User.RaiseMessage("add <name> [ <uri> ] - argument missing, perhaps you forgot it?");
                return(Exit.BADOPT);
            }

            if (options.uri == null)
            {
                RepositoryList repositoryList;

                try
                {
                    repositoryList = FetchMasterRepositoryList();
                }
                catch
                {
                    User.RaiseError("Couldn't fetch CFAN repositories master list from {0}", Repository.default_repo_master_list.ToString());
                    return(Exit.ERROR);
                }

                foreach (Repository candidate in repositoryList.repositories)
                {
                    if (String.Equals(candidate.name, options.name, StringComparison.OrdinalIgnoreCase))
                    {
                        options.name = candidate.name;
                        options.uri  = candidate.uri.ToString();
                    }
                }

                // Nothing found in the master list?
                if (options.uri == null)
                {
                    User.RaiseMessage("Name {0} not found in master list, please provide name and uri.", options.name);
                    return(Exit.BADOPT);
                }
            }

            log.DebugFormat("About to add repository '{0}' - '{1}'", options.name, options.uri);
            SortedDictionary <string, Repository> repositories = manager.registry.Repositories;

            if (repositories.ContainsKey(options.name))
            {
                User.RaiseMessage("Repository with name \"{0}\" already exists, aborting..", options.name);
                return(Exit.BADOPT);
            }

            repositories.Add(options.name, new Repository(options.name, options.uri));

            User.RaiseMessage("Added repository '{0}' - '{1}'", options.name, options.uri);
            manager.Save();

            return(Exit.OK);
        }
コード例 #26
0
        public ActionResult Options(string id, Options options)
        {
            var cmd = new AddOptions
            {
                FormId  = id,
                Options = options,
            };

            return(Exec(cmd,
                        success: next => RedirectNext(next),
                        failure: () => Options_Render(id, options)));
        }
コード例 #27
0
ファイル: AddCommand.cs プロジェクト: MangoTwo2/gsub
        private static void SaveOptionToConfig(AddOptions options)
        {
            var config = Configuration.Load();

            if (config.Subtrees.Exists(t => t.Alias == options.Alias))
            {
                Console.WriteLine($"alias {options.Alias} already exists.");
                return;
            }

            config.Subtrees.Add(options);
            config.Save();
        }
コード例 #28
0
        static async Task <int> Add(AddOptions options)
        {
            try
            {
                await UserRegistrationCommandService.RegisterUser(options.Email, options.Password.ToSecureString());
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }

            return(0);
        }
コード例 #29
0
 protected void Add()
 {
     if (_callBack_List_OnAdd != null)
     {
         _callBack_List_OnAdd(_list);
     }
     else if (_callBack_List_OnAddOptions != null)
     {
         AddOptions.Clear();
         _callBack_List_OnAddOptions(_list, AddOptions);
         AddOptions.ShowAsContext();
     }
 }
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new MetadataApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath    = "documents/input.docx",
                    StorageName = Common.MyStorage
                };

                var now     = DateTime.Now.ToString("MM-dd-yyyy hh:mm:ss");
                var options = new AddOptions
                {
                    FileInfo   = fileInfo,
                    Properties = new List <AddProperty>
                    {
                        new AddProperty
                        {
                            Value          = now,
                            Type           = "DateTime",
                            SearchCriteria = new SearchCriteria
                            {
                                NameOptions = new NameOptions
                                {
                                    Value        = "^.*print.*",
                                    MatchOptions = new MatchOptions
                                    {
                                        IsRegex = true
                                    }
                                }
                            },
                        }
                    }
                };

                var request = new AddRequest(options);

                var response = apiInstance.Add(request);
                Console.WriteLine($"Count of changes: {response.AddedCount}");
                Console.WriteLine("Resultant file path: " + response.Path);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling MetadataApi: " + e.Message);
            }
        }
コード例 #31
0
ファイル: KSP.cs プロジェクト: adamhomer88/CKAN
        private int AddInstall(AddOptions options)
        {
            if (options.name == null || options.path == null)
            {
                User.RaiseMessage("add <name> <path> - argument missing, perhaps you forgot it?");
                return Exit.BADOPT;
            }

            if (Manager.HasInstance(options.name))
            {
                User.RaiseMessage("Install with name \"{0}\" already exists, aborting..", options.name);
                return Exit.BADOPT;
            }

            try
            {
                string path = options.path;
                Manager.AddInstance(options.name, new CKAN.KSP(path, User));
                User.RaiseMessage("Added \"{0}\" with root \"{1}\" to known installs", options.name, options.path);
                return Exit.OK;
            }
            catch (NotKSPDirKraken ex)
            {
                User.RaiseMessage("Sorry, {0} does not appear to be a KSP directory", ex.path);
                return Exit.BADOPT;
            }
        }
コード例 #32
0
ファイル: Repo.cs プロジェクト: Zor-X-L/CKAN
        private int AddRepository(AddOptions options)
        {
            RegistryManager manager = Manager.CurrentInstance.RegistryManager;

            if (options.name == null)
            {
                User.RaiseMessage("add <name> [ <uri> ] - argument missing, perhaps you forgot it?");
                return Exit.BADOPT;
            }

            if (options.uri == null)
            {
                RepositoryList repositoryList;

                try
                {
                    repositoryList = FetchMasterRepositoryList();
                }
                catch
                {
                    User.RaiseError("Couldn't fetch CKAN repositories master list from {0}", Repository.default_repo_master_list.ToString());
                    return Exit.ERROR;
                }

                foreach (Repository candidate in repositoryList.repositories)
                {
                    if (String.Equals(candidate.name, options.name, StringComparison.OrdinalIgnoreCase))
                    {
                        options.name = candidate.name;
                        options.uri = candidate.uri.ToString();
                    }
                }

                // Nothing found in the master list?
                if (options.uri == null)
                {
                    User.RaiseMessage("Name {0} not found in master list, please provide name and uri.", options.name);
                    return Exit.BADOPT;
                }
            }

            log.DebugFormat("About to add repository '{0}' - '{1}'", options.name, options.uri);
            SortedDictionary<string, Repository> repositories = manager.registry.Repositories;

            if (repositories.ContainsKey(options.name))
            {
                User.RaiseMessage("Repository with name \"{0}\" already exists, aborting..", options.name);
                return Exit.BADOPT;
            }

            repositories.Add(options.name, new Repository(options.name, options.uri));

            User.RaiseMessage("Added repository '{0}' - '{1}'", options.name, options.uri);
            manager.Save();

            return Exit.OK;
        }