Skip to content

Commit 9c13ff4

Browse files
committed
chore: quickstart
1 parent 95f5bda commit 9c13ff4

File tree

8 files changed

+99
-52
lines changed

8 files changed

+99
-52
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"rollForward": false
1111
},
1212
"paket": {
13-
"version": "9.0.2",
13+
"version": "10.0.0-alpha011",
1414
"commands": [
1515
"paket"
1616
],

extLauncher.Tests/AppTests.fs

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,15 @@ let ``should filter out files in ignored folders when loading`` () =
116116

117117
allFiles
118118
|> Array.filter (fun (filePath: FilePath, _) ->
119-
not (foldersToIgnore
119+
not (
120+
foldersToIgnore
120121
|> Array.exists (fun (folderToIgnore: FolderPath) ->
121-
filePath.value.StartsWith(folderToIgnore.value, System.StringComparison.CurrentCultureIgnoreCase)))
122+
filePath.value.StartsWith(
123+
folderToIgnore.value,
124+
System.StringComparison.CurrentCultureIgnoreCase
125+
)
126+
)
127+
)
122128
)
123129

124130
App.loadFolder loadFiles {
@@ -190,23 +196,35 @@ let ``should filter out files in multiple ignored folders`` () =
190196

191197
allFiles
192198
|> Array.filter (fun (filePath: FilePath, _) ->
193-
not (foldersToIgnore
199+
not (
200+
foldersToIgnore
194201
|> Array.exists (fun (folderToIgnore: FolderPath) ->
195-
filePath.value.StartsWith(folderToIgnore.value, System.StringComparison.CurrentCultureIgnoreCase)))
202+
filePath.value.StartsWith(
203+
folderToIgnore.value,
204+
System.StringComparison.CurrentCultureIgnoreCase
205+
)
206+
)
207+
)
196208
)
197209

198210
App.loadFolder loadFiles {
199211
Path = folderPath
200212
Pattern = Pattern.init pattern false
201-
FoldersToIgnore = [| ignoredFolder1; ignoredFolder2 |]
213+
FoldersToIgnore = [|
214+
ignoredFolder1
215+
ignoredFolder2
216+
|]
202217
Launchers = Array.empty
203218
}
204219

205220
folder
206221
=! Some {
207222
Path = folderPath
208223
Pattern = Pattern.init pattern false
209-
FoldersToIgnore = [| ignoredFolder1; ignoredFolder2 |]
224+
FoldersToIgnore = [|
225+
ignoredFolder1
226+
ignoredFolder2
227+
|]
210228
Files = [|
211229
File.create (FilePath "/test/file1.ext") (FileName "file1")
212230
File.create (FilePath "/test/other/file4.ext") (FileName "file4")
@@ -230,9 +248,15 @@ let ``should filter out files in subdirectories of ignored folders`` () =
230248

231249
allFiles
232250
|> Array.filter (fun (filePath: FilePath, _) ->
233-
not (foldersToIgnore
251+
not (
252+
foldersToIgnore
234253
|> Array.exists (fun (folderToIgnore: FolderPath) ->
235-
filePath.value.StartsWith(folderToIgnore.value, System.StringComparison.CurrentCultureIgnoreCase)))
254+
filePath.value.StartsWith(
255+
folderToIgnore.value,
256+
System.StringComparison.CurrentCultureIgnoreCase
257+
)
258+
)
259+
)
236260
)
237261

238262
App.loadFolder loadFiles {
@@ -247,15 +271,14 @@ let ``should filter out files in subdirectories of ignored folders`` () =
247271
Path = folderPath
248272
Pattern = Pattern.init pattern false
249273
FoldersToIgnore = [| ignoredFolder |]
250-
Files = [|
251-
File.create (FilePath "/test/file1.ext") (FileName "file1")
252-
|]
274+
Files = [| File.create (FilePath "/test/file1.ext") (FileName "file1") |]
253275
Launchers = Array.empty
254276
}
255277

256278
[<Fact>]
257279
let ``refresh should filter out files in ignored folders`` () =
258280
let ignoredFolder = FolderPath.mk "/test/ignored"
281+
259282
let newFolder =
260283
let loadFiles _ foldersToIgnore _ =
261284
let allFiles = [|
@@ -266,9 +289,15 @@ let ``refresh should filter out files in ignored folders`` () =
266289

267290
allFiles
268291
|> Array.filter (fun (filePath: FilePath, _) ->
269-
not (foldersToIgnore
292+
not (
293+
foldersToIgnore
270294
|> Array.exists (fun (folderToIgnore: FolderPath) ->
271-
filePath.value.StartsWith(folderToIgnore.value, System.StringComparison.CurrentCultureIgnoreCase)))
295+
filePath.value.StartsWith(
296+
folderToIgnore.value,
297+
System.StringComparison.CurrentCultureIgnoreCase
298+
)
299+
)
300+
)
272301
)
273302

274303
let save = id
@@ -277,9 +306,7 @@ let ``refresh should filter out files in ignored folders`` () =
277306
Path = FolderPath.mk "/test"
278307
Pattern = Pattern.init "" false
279308
FoldersToIgnore = [| ignoredFolder |]
280-
Files = [|
281-
File.create (FilePath "file1") (FileName "")
282-
|]
309+
Files = [| File.create (FilePath "file1") (FileName "") |]
283310
Launchers = Array.empty
284311
}
285312
|> App.refresh loadFiles save

extLauncher.Tests/extLauncher.Tests.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<GenerateProgramFile>false</GenerateProgramFile>
77
<WarningsAsErrors>FS0025</WarningsAsErrors>

extLauncher/App.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ let index (loadFiles: LoadFiles) save (conf: FolderConf) : Folder option =
2929
let refresh (loadFiles: LoadFiles) save (folder: Folder) : Folder option =
3030

3131
let newFiles =
32-
loadFiles folder.Path folder.FoldersToIgnore folder.Pattern |> Array.map ((<||) File.create)
32+
loadFiles folder.Path folder.FoldersToIgnore folder.Pattern
33+
|> Array.map ((<||) File.create)
3334

3435
let currentFiles = folder.Files |> Array.map (fun f -> f.Path, f) |> Map
3536

extLauncher/Infra.fs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ module IO =
2323
|> Seq.filter (fun filePath ->
2424
not
2525
<| (foldersToIgnore
26-
|> Array.exists (fun folderToIgnore -> filePath.StartsWith(folderToIgnore.value, StringComparison.CurrentCultureIgnoreCase)))
26+
|> Array.exists (fun folderToIgnore ->
27+
filePath.StartsWith(folderToIgnore.value, StringComparison.CurrentCultureIgnoreCase)
28+
))
2729
)
2830

2931
let private enumerateFiles (path: FolderPath) (foldersToIgnore: FolderPath array) =
@@ -32,7 +34,12 @@ module IO =
3234
Directory.EnumerateFiles(
3335
path.value,
3436
pattern,
35-
EnumerationOptions(RecurseSubdirectories = true, IgnoreInaccessible = true, MatchType = MatchType.Simple, AttributesToSkip = FileAttributes.Hidden)
37+
EnumerationOptions(
38+
RecurseSubdirectories = true,
39+
IgnoreInaccessible = true,
40+
MatchType = MatchType.Simple,
41+
AttributesToSkip = FileAttributes.Hidden
42+
)
3643
)
3744
|> (filterIgnoredFolders foldersToIgnore)
3845

@@ -42,7 +49,12 @@ module IO =
4249
Directory.EnumerateFiles(
4350
path.value,
4451
"*",
45-
EnumerationOptions(RecurseSubdirectories = true, IgnoreInaccessible = true, MatchType = MatchType.Simple, AttributesToSkip = FileAttributes.Hidden)
52+
EnumerationOptions(
53+
RecurseSubdirectories = true,
54+
IgnoreInaccessible = true,
55+
MatchType = MatchType.Simple,
56+
AttributesToSkip = FileAttributes.Hidden
57+
)
4658
)
4759
|> Seq.filter (Path.GetFileName >> regex.IsMatch)
4860
|> (filterIgnoredFolders foldersToIgnore)

extLauncher/Program.fs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,18 @@ module Program =
335335
app.Configure(fun conf ->
336336
conf.SetApplicationName(IO.AppName) |> ignore
337337

338-
conf.AddCommand<PromptCommand>("prompt").WithDescription("[italic](default command)[/] Type to search. Arrows Up/Down to navigate. Enter to launch. Escape to quit.")
338+
conf
339+
.AddCommand<PromptCommand>("prompt")
340+
.WithDescription(
341+
"[italic](default command)[/] Type to search. Arrows Up/Down to navigate. Enter to launch. Escape to quit."
342+
)
339343
|> ignore
340344

341345
conf
342346
.AddCommand<IndexCommand>("index")
343-
.WithDescription("Indexes all files recursively with a specific pattern which can be a wildcard [italic](default)[/] or a regular expression.")
347+
.WithDescription(
348+
"Indexes all files recursively with a specific pattern which can be a wildcard [italic](default)[/] or a regular expression."
349+
)
344350
|> ignore
345351

346352
conf.AddBranch<LauncherSettings>(
@@ -359,7 +365,9 @@ module Program =
359365
conf.AddCommand<DeindexCommand>("deindex").WithDescription("Clears the current index.")
360366
|> ignore
361367

362-
conf.AddCommand<InfoCommand>("info").WithDescription("Prints the current pattern and all the indexed files.")
368+
conf
369+
.AddCommand<InfoCommand>("info")
370+
.WithDescription("Prints the current pattern and all the indexed files.")
363371
|> ignore
364372

365373
conf.AddCommand<RefreshCommand>("refresh").WithDescription("Updates the current index.")

extLauncher/extLauncher.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net9.0</TargetFrameworks>
5+
<TargetFrameworks>net10.0</TargetFrameworks>
66
<LangVersion>preview</LangVersion>
77
<UseAppHost>true</UseAppHost>
88
<PackAsTool>true</PackAsTool>

0 commit comments

Comments
 (0)