feat: no-ignore-parent shorthand option for find_files. (#1963)

This commit is contained in:
Jeremy Neal
2022-06-06 08:06:34 -04:00
committed by Simon Hauser
parent a6c9ae088e
commit 8488cd5ac7
3 changed files with 27 additions and 13 deletions

View File

@@ -878,18 +878,21 @@ builtin.find_files({opts}) *telescope.builtin.find_files()*
{opts} (table) options to pass to the picker {opts} (table) options to pass to the picker
Options: ~ Options: ~
{cwd} (string) root dir to search from (default: cwd, use {cwd} (string) root dir to search from (default: cwd,
utils.buffer_dir() to search relative to use utils.buffer_dir() to search
open buffer) relative to open buffer)
{find_command} (table) command line arguments for `find_files` to {find_command} (table) command line arguments for `find_files`
use for the search, overrides default: to use for the search, overrides
config default: config
{follow} (boolean) if true, follows symlinks (i.e. uses `-L` {follow} (boolean) if true, follows symlinks (i.e. uses
flag for the `find` command) `-L` flag for the `find` command)
{hidden} (boolean) determines whether to show hidden files or {hidden} (boolean) determines whether to show hidden files
not (default: false) or not (default: false)
{no_ignore} (boolean) show files ignored by .gitignore, .ignore, {no_ignore} (boolean) show files ignored by .gitignore,
etc. (default: false) .ignore, etc. (default: false)
{no_ignore_parent} (boolean) show files ignored by .gitignore,
.ignore, etc. in parent dirs. (default:
false)
{search_dirs} (table) directory/directories to search in {search_dirs} (table) directory/directories to search in

View File

@@ -183,6 +183,7 @@ files.find_files = function(opts)
local command = find_command[1] local command = find_command[1]
local hidden = opts.hidden local hidden = opts.hidden
local no_ignore = opts.no_ignore local no_ignore = opts.no_ignore
local no_ignore_parent = opts.no_ignore_parent
local follow = opts.follow local follow = opts.follow
local search_dirs = opts.search_dirs local search_dirs = opts.search_dirs
@@ -199,6 +200,9 @@ files.find_files = function(opts)
if no_ignore then if no_ignore then
table.insert(find_command, "--no-ignore") table.insert(find_command, "--no-ignore")
end end
if no_ignore_parent then
table.insert(find_command, "--no-ignore-parent")
end
if follow then if follow then
table.insert(find_command, "-L") table.insert(find_command, "-L")
end end
@@ -218,6 +222,9 @@ files.find_files = function(opts)
if no_ignore ~= nil then if no_ignore ~= nil then
log.warn "The `no_ignore` key is not available for the `find` command in `find_files`." log.warn "The `no_ignore` key is not available for the `find` command in `find_files`."
end end
if no_ignore_parent ~= nil then
log.warn "The `no_ignore_parent` key is not available for the `find` command in `find_files`."
end
if follow then if follow then
table.insert(find_command, 2, "-L") table.insert(find_command, 2, "-L")
end end
@@ -234,6 +241,9 @@ files.find_files = function(opts)
if no_ignore ~= nil then if no_ignore ~= nil then
log.warn "The `no_ignore` key is not available for the Windows `where` command in `find_files`." log.warn "The `no_ignore` key is not available for the Windows `where` command in `find_files`."
end end
if no_ignore_parent ~= nil then
log.warn "The `no_ignore_parent` key is not available for the Windows `where` command in `find_files`."
end
if follow ~= nil then if follow ~= nil then
log.warn "The `follow` key is not available for the Windows `where` command in `find_files`." log.warn "The `follow` key is not available for the Windows `where` command in `find_files`."
end end

View File

@@ -81,6 +81,7 @@ builtin.grep_string = require_on_exported_call("telescope.builtin.files").grep_s
---@field follow boolean: if true, follows symlinks (i.e. uses `-L` flag for the `find` command) ---@field follow boolean: if true, follows symlinks (i.e. uses `-L` flag for the `find` command)
---@field hidden boolean: determines whether to show hidden files or not (default: false) ---@field hidden boolean: determines whether to show hidden files or not (default: false)
---@field no_ignore boolean: show files ignored by .gitignore, .ignore, etc. (default: false) ---@field no_ignore boolean: show files ignored by .gitignore, .ignore, etc. (default: false)
---@field no_ignore_parent boolean: show files ignored by .gitignore, .ignore, etc. in parent dirs. (default: false)
---@field search_dirs table: directory/directories to search in ---@field search_dirs table: directory/directories to search in
builtin.find_files = require_on_exported_call("telescope.builtin.files").find_files builtin.find_files = require_on_exported_call("telescope.builtin.files").find_files