public ListCommand()
        {
            IsCommand("list", "print lists. eg. project list, task lists, ...");

            HasLongDescription("");

            HasOption("c|columns:", "columns separated by comma",
                      t => Columns = t?.Split(','));

            HasOption("e|entity:", "entity to list: Project, Task or TimeTracking",
                      t => Entity = EnumParser.ParseFuzzy <Entity>(t ?? nameof(Entity.Project)));
        }
        public PropertiesCommand()
        {
            IsCommand("print-properties", "print properties of entities");

            HasOption("e|entity:", "entity to list: Project, Task or TimeTracking",
                      t => Entity = EnumParser.ParseFuzzy <Entity>(t ?? nameof(Entity.Project)));

            HasOption("t|print-type:", "print type",
                      k => PrintType = k == null || Convert.ToBoolean(k));

            HasOption("w|print-writeable:", "print if field is writeable",
                      k => PrintAccess = k == null || Convert.ToBoolean(k));
        }
        public ImportCsvCommand()
        {
            IsCommand("import-csv", "import a csv utility to InLoox");

            HasLongDescription("Import a csv file and create/update InLoox objects");

            HasRequiredOption("f|file=", "The full path of the csv file to import",
                              p => FileLocation = p);

            HasOption("k|keep-open:", "keeps console open",
                      t => KeepConsoleOpen = t == null || Convert.ToBoolean(t));

            HasOption("e|entity:", "entity to list: Project, Task or TimeTracking",
                      t => Entity = EnumParser.ParseFuzzy <Entity>(t ?? nameof(Entity.Task)));
        }
        public override int Run(string[] remainingArguments)
        {
            var defaultColor = Console.ForegroundColor;

            try
            {
                if (remainingArguments.Length > 0)
                {
                    Entity = EnumParser.ParseFuzzy <Entity>(remainingArguments[0]);
                }

                var client = StaticDI.GetDefaultClient();
                if (!client.Logon())
                {
                    Console.WriteLine("Username password wrong");
                    return(FailureState);
                }

                var sync = new CsvSync(client, Entity);
                sync.Run(FileLocation).Wait();

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("done.");
                Console.ForegroundColor = defaultColor;

                if (KeepConsoleOpen)
                {
                    Console.ReadLine();
                }

                return(SuccessState);
            }
            catch (Exception ex)
            {
                Exceptions.PrintException(ex);
                return(FailureState);
            }
        }