Example #1
0
        public bool TryParse(MoveCommandOptions options)
        {
            var baseOptions = (CommonCopyCommandOptions)options;

            if (!TryParse(baseOptions))
            {
                return(false);
            }

            options = (MoveCommandOptions)baseOptions;

            if (!TryParseAsEnumFlags(Compare, OptionNames.Compare, out FileCompareOptions compareOptions, FileCompareOptions.None, OptionValueProviders.FileCompareOptionsProvider))
            {
                return(false);
            }

            if (!TryEnsureFullPath(Target, out string target))
            {
                return(false);
            }

            if (!TryParseAsEnum(Conflict, OptionNames.Conflict, out ConflictResolution conflictResolution, defaultValue: ConflictResolution.Ask, provider: OptionValueProviders.ConflictResolutionProvider))
            {
                return(false);
            }

            options.CompareOptions     = compareOptions;
            options.DryRun             = DryRun;
            options.Flat               = Flat;
            options.ConflictResolution = conflictResolution;
            options.Target             = target;

            return(true);
        }
Example #2
0
 internal static void WriteMoveCommand(MoveCommandOptions options)
 {
     WriteOption("ask", options.AskMode);
     WriteOption("attributes", options.Attributes);
     WriteOption("attributes to skip", options.AttributesToSkip);
     WriteOption("compare", options.CompareOptions);
     WriteOption("conflict resolution", options.ConflictResolution);
     WriteFilter("content filter", options.ContentFilter);
     WriteEncoding("default encoding", options.DefaultEncoding);
     WriteFilter("directory filter", options.DirectoryFilter, options.DirectoryNamePart);
     WriteDisplayFormat("display", options.Format);
     WriteOption("dry run", options.DryRun);
     WriteOption("empty", options.EmptyOption);
     WriteFilter("extension filter", options.ExtensionFilter);
     WriteFilePropertyFilter(
         "file properties",
         options.SizePredicate,
         options.CreationTimePredicate,
         options.ModifiedTimePredicate);
     WriteOption("flat", options.Flat);
     WriteOption("highlight options", options.HighlightOptions);
     WriteOption("max matching files", options.MaxMatchingFiles);
     WriteOption("max matches in file", options.MaxMatchesInFile);
     WriteFilter("name filter", options.NameFilter, options.NamePart);
     WritePaths("paths", options.Paths);
     WriteOption("progress", options.Progress);
     WriteOption("recurse subdirectories", options.RecurseSubdirectories);
     WriteOption("search target", options.SearchTarget);
     WriteSortOptions("sort", options.SortOptions);
     WriteOption("target", options.Target);
 }
Example #3
0
        private static int Move(MoveCommandLineOptions commandLineOptions)
        {
            var options = new MoveCommandOptions();

            if (!commandLineOptions.TryParse(options))
            {
                return(1);
            }

            return(Execute(new MoveCommand(options)));
        }