-
Notifications
You must be signed in to change notification settings - Fork 41
Feat: add recursive group search #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,6 @@ when needed. | |
| 2. Create a [personal GitLab access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#creating-a-personal-access-token) with the `read_api` scope. | ||
|
|
||
| ## Installation | ||
|
|
||
| ``` | ||
| $ npm install -g gitlab-search | ||
| ``` | ||
|
|
@@ -39,11 +38,12 @@ $ gitlab-search [options] [command] <search-term> | |
| Options: | ||
| -V, --version output the version number | ||
| -g, --groups <group-names> group(s) to find repositories in (separated with comma) | ||
| -r, --recursive Search recursively in projects in the given groups | ||
| -f, --filename <filename> only search for contents in given a file, glob matching with wildcards (*) | ||
| -e, --extension <file-extension> only search for contents in files with given extension | ||
| -p, --path <path> only search in files in the given path | ||
| -a, --archive [all,only,exclude] search only in archived projects, exclude archived projects, search in all projects (default is all) | ||
| -h, --help output usage information | ||
| -a, --archive [all,only,exclude] to only search on archived repositories, or to exclude them, by default the search will be apply to all repositories (default: "all") | ||
| -h, --help display help for command | ||
|
|
||
| Commands: | ||
| setup [options] <personal-access-token> create configuration file | ||
|
|
@@ -86,6 +86,18 @@ Requesting: GET https://gitlab.com/api/v4/projects/666/search?scope=blobs&search | |
| Requesting: GET https://gitlab.com/api/v4/projects/999/search?scope=blobs&search=here-is-my-search-term | ||
| ``` | ||
|
|
||
| ## Installing from source | ||
| 1. Install node 14.x | ||
| 2. Clone this repository | ||
| 3. Build with | ||
| ```sh | ||
| $ npm run build | ||
| ``` | ||
| 4. Run from bin directory | ||
| ```sh | ||
| $ bin/gitlab-search.js -h | ||
| ``` | ||
|
Comment on lines
+89
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be a separate commit? The prerequisites don't list a specific NodeJS version, and it doesn't seem to be required from what I tested. |
||
|
|
||
| ## License | ||
|
|
||
| MIT | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ let main = (args, options) => { | |
|
|
||
| Js.Promise.( | ||
| GitLab.fetchGroups(groups) | ||
| |> then_(GitLab.fetchProjectsInGroups(getOption("archive"))) | ||
| |> then_(GitLab.fetchProjectsInGroups(getOption("archive"), getOption("recursive"))) | ||
| |> then_(GitLab.searchInProjects(criterias)) | ||
| |> then_(results => | ||
| resolve(Print.searchResults(criterias.term, results)) | ||
|
|
@@ -63,6 +63,7 @@ Commander.( | |
| "-g, --groups <group-names>", | ||
| "group(s) to find repositories in (separated with comma)", | ||
| ) | ||
| |> option("-r, --recursive", "Search recursively in projects in the given groups") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: lowercase is used for the other options (also update README) |
||
| |> option( | ||
| "-f, --filename <filename>", | ||
| "only search for contents in given a file, glob matching with wildcards (*)", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: don't remove this newline.