Example #1
0
        private int RunCommand()
        {
            if (all.HasValue())
            {
                HostsFile.RemoveAll();
                return(Ok);
            }

            if (ip.HasValue() && host.HasValue())
            {
                Program.WriteLine("When removing a map, specify either ip or host name, not both");
                return(1);
            }
            if (!ip.HasValue() && !host.HasValue())
            {
                Program.WriteLine("When removing a map, specify at least ip or host name");
                return(1);
            }

            if (ip.HasValue())
            {
                HostsFile.RemoveByIp(ip.Value());
            }

            if (host.HasValue())
            {
                HostsFile.RemoveByHostName(host.Value());
            }

            return(Ok);
        }