loader: Use ast_cli_completion_add for 'module load' completion.

This addresses all performance issues with 'module load' completion.  In
addition to using ast_cli_completion_add we stop using libedit's
filename_completion_function, instead using ast_file_read_dir.  This
ensures all results are produced from a single call to opendir.

Change-Id: I8bf51ffaa7ef1606f3bd1b5bb13f1905d72c6134
This commit is contained in:
Corey Farrell
2018-01-25 13:06:12 -05:00
parent ede9185249
commit 154bccf147
3 changed files with 54 additions and 50 deletions

View File

@@ -143,6 +143,11 @@ int ast_filecopy(const char *oldname, const char *newname, const char *fmt);
* \param filename the name of the file
* \param obj user data object
* \return non-zero to stop reading, otherwise zero to continue
*
* \note dir_name is not processed by realpath or other functions,
* symbolic links are not resolved. This ensures dir_name
* always starts with the exact string originally passed to
* \ref ast_file_read_dir or \ref ast_file_read_dirs.
*/
typedef int (*ast_file_on_file)(const char *dir_name, const char *filename, void *obj);