diff options
Diffstat (limited to 'Shell/Builtin.cpp')
-rw-r--r-- | Shell/Builtin.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Shell/Builtin.cpp b/Shell/Builtin.cpp index a0a7c539c4..e19e8cfce3 100644 --- a/Shell/Builtin.cpp +++ b/Shell/Builtin.cpp @@ -327,6 +327,23 @@ int Shell::builtin_export(int argc, const char** argv) return 0; } +int Shell::builtin_glob(int argc, const char** argv) +{ + Vector<const char*> globs; + Core::ArgsParser parser; + parser.add_positional_argument(globs, "Globs to resolve", "glob"); + + if (!parser.parse(argc, const_cast<char**>(argv), false)) + return 1; + + for (auto& glob : globs) { + for (auto& expanded : expand_globs(glob, cwd)) + outln("{}", expanded); + } + + return 0; +} + int Shell::builtin_fg(int argc, const char** argv) { int job_id = -1; |