forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfd.ts
156 lines (155 loc) · 3.78 KB
/
fd.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
const completionSpec: Fig.Spec = {
name: "fd",
description: "A simple, fast and user-friendly alternative to 'find'",
options: [
{
name: ["-H", "--hidden"],
description: "Search hidden files and directories",
},
{
name: ["-I", "--no-ignore"],
description: "Do not respect .(git|fd)ignore files",
},
{
name: ["-s", "--case-sensitive"],
description: "Case-sensitive search (default: smart case)",
},
{
name: ["-i", "--ignore-case"],
description: "Case-insensitive search (default: smart case)",
},
{
name: ["-g", "--glob"],
description: "Glob-based search (default: regular expression)",
},
{
name: ["-a", "--absolute-path"],
description: "Show absolute instead of relative paths",
},
{
name: ["-l", "--list-details"],
description: "Use a long listing format with file metadata",
},
{
name: ["-L", "--follow"],
description: "Follow symbolic links",
},
{
name: ["-p", "--full-path"],
description: "Search full path (default: file-/dirname only)",
},
{
name: ["-0", "--print0"],
description: "Separate results by the null character",
},
{
name: ["-h", "--help"],
description: "Prints help information",
},
{
name: ["-V", "--version"],
description: "Prints version information",
},
{
name: ["-d", "--max-depth"],
description: "Set maximum search depth",
args: {
name: "depth",
},
},
{
name: ["-t", "--type"],
description: "Filter by type",
isRepeatable: true,
args: {
name: "filetype",
suggestions: [
{ name: "f", description: "File" },
{ name: "d", description: "Directory" },
{ name: "l", description: "Symlink" },
{ name: "x", description: "Executable" },
{ name: "e", description: "Empty" },
{ name: "s", description: "Socket" },
{ name: "p", description: "Pipe" },
],
},
},
{
name: ["-e", "--extension"],
isRepeatable: true,
description: "Filter by file extension",
args: {
name: "file extension",
},
},
{
name: ["-x", "--exec"],
description: "Execute a command for each search result",
args: {
name: "cmd",
isCommand: true,
},
},
{
name: ["-X", "--exec-batch"],
description: "Execute a command with all search results at once",
args: {
name: "cmd",
isCommand: true,
},
},
{
name: ["-E", "--exclude"],
isRepeatable: true,
description: "Exclude entries that match the given glob pattern",
args: {
name: "pattern",
},
},
{
name: ["-c", "--color"],
description: "When to use colors",
args: {
name: "when",
default: "auto",
suggestions: ["never", "auto", "always"],
},
},
{
name: ["-S", "--size"],
description: "Limit results based on the size of files",
args: {
name: "size",
},
},
{
name: "--changed-within",
description: "Filter by file modification time (newer than)",
args: {
name: "date",
},
},
{
name: "--changed-before",
description: "Filter by file modification time (older than)",
args: {
name: "date",
},
},
],
args: [
{
name: "pattern",
description:
"The search pattern - a regular expression unless '--glob' is used (optional)",
},
{
name: "path",
description: "The root directories for the filesystem search",
template: ["folders"],
isOptional: true,
isVariadic: true,
},
],
};
export default completionSpec;