-
Notifications
You must be signed in to change notification settings - Fork 112
add: fpm search #1054
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: main
Are you sure you want to change the base?
add: fpm search #1054
Conversation
' --license License type to filter results.', & | ||
' --limit Maximum number of results to return.', & | ||
' --sort-by Field to sort results by (e.g., name).', & | ||
' --sort Sort order (asc for ascending, desc for descending).', & |
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.
It would be extremely beneficial to add a few examples of search commands that can be used to search for packages. That gives the reader a better idea of what the command can do, how it works, and how it is integrated with either a local registry or the online registry.
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.
I will add some sample queries for each parameter so that it is easy to refer.
Let's get this merged @henilp105, is there any more tasks you plan of adding? |
Sure @perazz , Let's get this merged in a week, I will add some tests and clean UI by then. |
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.
Pull Request Overview
This PR adds a new fpm search
command that enables searching for packages in both local registries and the fpm-registry. Users can search using various filters including query text, package name, namespace, version, and license with support for globbing patterns.
- Adds comprehensive search functionality with multiple filter options and sorting capabilities
- Integrates search command into the existing fpm CLI structure with help documentation
- Updates downloader module to properly quote URLs in curl/wget commands
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
test/help_test/help_test.f90 | Adds 'search' command to help test suite |
src/fpm_command_line.f90 | Implements search command line parsing, help text, and settings structure |
src/fpm/downloader.f90 | Adds quotes around URLs in curl/wget commands for better URL handling |
src/fpm/cmd/search.f90 | New module implementing the core search functionality for local and remote registries |
app/main.f90 | Integrates search command into main application dispatcher |
Comments suppressed due to low confidence (1)
src/fpm_command_line.f90:1
- Typo in help text: 'fmp-registry' should be 'fpm-registry'.
!># Definition of the command line interface
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
||
!> Settings for searching for packages in local and remote registries | ||
type, extends(fpm_cmd_settings) :: fpm_search_settings | ||
character(len=:),allocatable :: query !> search for packages with a specific query (globbing supported) |
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.
There's a trailing space at the end of the comment line.
character(len=:),allocatable :: query !> search for packages with a specific query (globbing supported) | |
character(len=:),allocatable :: query !>search for packages with a specific query (globbing supported) |
Copilot uses AI. Check for mistakes.
if (namespace==' ') namespace='*' | ||
if (package_version==' ') package_version='*' | ||
if (.not. registry=='') then | ||
print *, 'Using custom registry for seaching packages: ', registry |
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.
Typo in the print statement: 'seaching' should be 'searching'.
print *, 'Using custom registry for seaching packages: ', registry | |
print *, 'Using custom registry for searching packages: ', registry |
Copilot uses AI. Check for mistakes.
' + install Install project. ', & | ||
' + clean Delete directories in the "build/" directory, except ', & | ||
' dependencies. Prompts for confirmation to delete. ', & | ||
' + search Search for packages in local and fpm-registry ', & |
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.
Missing article in help text: should be 'local registry and fpm-registry' or 'local and remote registries'.
' + search Search for packages in local and fpm-registry ', & | |
' + search Search for packages in the local registry and fpm-registry', & |
Copilot uses AI. Check for mistakes.
'' ] | ||
help_search=[character(len=80) :: & | ||
'NAME', & | ||
' search(1) - search for the package in local and fpm - registry.', & |
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.
Inconsistent spacing and grammar: should be 'search for packages in local registry and fpm-registry' (no spaces around hyphen).
' search(1) - search for the package in local and fpm - registry.', & | |
' search(1) - search for the package in local and fpm-registry.', & |
Copilot uses AI. Check for mistakes.
!> The package can be searched by packagename, namespace, query (description and README.md), and license from the registries (local and remote). | ||
!> the remote registry URL can also be specified by the paramter --registry. |
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.
Multiple issues: 'packagename' should be 'package name', 'paramter' should be 'parameter', and the second line should start with a capital letter.
!> The package can be searched by packagename, namespace, query (description and README.md), and license from the registries (local and remote). | |
!> the remote registry URL can also be specified by the paramter --registry. | |
!> The package can be searched by package name, namespace, query (description and README.md), and license from the registries (local and remote). | |
!> The remote registry URL can also be specified by the parameter --registry. |
Copilot uses AI. Check for mistakes.
if (json%has_key("packages")) then | ||
call get_value(json, 'packages', array) | ||
print * | ||
print '(A,I0,A)', ' Found ', len(array), ' packages in fpm - registry:' |
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.
Inconsistent spacing: should be 'fpm-registry' (no spaces around hyphen).
print '(A,I0,A)', ' Found ', len(array), ' packages in fpm - registry:' | |
print '(A,I0,A)', ' Found ', len(array), ' packages in fpm-registry:' |
Copilot uses AI. Check for mistakes.
use fpm_downloader, only: downloader_t | ||
use fpm_strings, only: string_t, string_array_contains, split, str,glob | ||
use fpm, only: build_model | ||
use fpm_error, only : error_t, fatal_error, fpm_stop |
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.
Duplicate import of fpm_error module. The module is already imported on line 9 with error_t and fpm_stop. Consider consolidating these imports.
Copilot uses AI. Check for mistakes.
This PR intends to add the search and discovery of fpm installed and fpm - registry packages directly from cli. this command supports globbing for package name, version, license, namespace. the similar functionality has been patched at the registry repo. (fortran-lang/registry#81). paging is not used in local registry due to multiple search queries.
This is the syntax of the new fpm search functionality:
Parameters:
Tasks left
Thanks and Regards,
Henil
CC @certik @awvwgk @perazz @arteevraina