// actual work with callid the providers internal void Get(string[] paths, bool recurse, ProviderRuntime runtime) { // the include/exclude filters apply to the results, not to the globbing process. Make this sure runtime.IgnoreFiltersForGlobbing = true; // globbing is here a little more complicated, so we do it "manually" (without GlobAndInvoke) foreach (var curPath in paths) { var path = curPath; // if the path won't be globbed or filtered, we will directly list it's child var listChildsWithoutRecursion = !Globber.ShouldGlob(path, runtime) && !runtime.HasFilters(); // the Path might be a mixture of a path and an include filter bool clearIncludeFilter; path = SplitFilterFromPath(path, recurse, runtime, out clearIncludeFilter); // now perform the actual globbing CmdletProvider provider; var globbed = Globber.GetGlobbedProviderPaths(path, runtime, out provider); var containerProvider = CmdletProvider.As<ContainerCmdletProvider>(provider); var filter = new IncludeExcludeFilter(runtime.Include, runtime.Exclude, false); foreach (var globPath in globbed) { try { // if we need to actively filter that stuff, we have to handle the recursion manually if (!filter.CanBeIgnored) { ManuallyGetChildItems(containerProvider, globPath, recurse, filter, runtime); return; } // otherwise just get the child items / the item directly if (recurse || listChildsWithoutRecursion) { GetItemOrChildItems(containerProvider, globPath, recurse, runtime); return; } // no recursion and globbing was performed: get the item, not the child items containerProvider.GetItem(globPath, runtime); } catch (Exception e) { HandleCmdletProviderInvocationException(e); } } // clean up the include filter of the runtime for the next item, if we split a filter from the path if (clearIncludeFilter) { runtime.Include.Clear(); } } }