Skip to content

Commit 508e2d7

Browse files
committed
some code cleanup
1 parent 51cf4dd commit 508e2d7

File tree

5 files changed

+32
-22
lines changed

5 files changed

+32
-22
lines changed

Sources/utiluti/AppCommands.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ struct AppCommands: ParsableCommand {
1414
static let configuration = CommandConfiguration(
1515
commandName: "app",
1616
abstract: "list uniform types identifiers and url schemes associated with an app",
17-
subcommands: [ Types.self, Schemes.self ]
17+
subcommands: [
18+
Types.self,
19+
Schemes.self
20+
]
1821
)
1922

2023
struct Types: ParsableCommand {

Sources/utiluti/GetUTI.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import Foundation
99
import ArgumentParser
1010
import UniformTypeIdentifiers
1111

12-
@available(macOS 11.0, *)
1312
struct GetUTI: ParsableCommand {
1413
static let configuration
1514
= CommandConfiguration(abstract: "Get the type identifier (UTI) for a file extension")

Sources/utiluti/TypeCommands.swift

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,17 @@ import ArgumentParser
1010
import UniformTypeIdentifiers
1111

1212
struct TypeCommands: ParsableCommand {
13-
14-
static var subCommands: [ParsableCommand.Type] {
15-
if #available(macOS 11.0, *) {
16-
return [Get.self, List.self, Set.self, Info.self, FileExtensions.self]
17-
} else {
18-
return[Get.self, List.self, Set.self]
19-
}
20-
}
21-
13+
2214
static let configuration = CommandConfiguration(
2315
commandName: "type",
2416
abstract: "Manipulate default file type handlers",
25-
subcommands: subCommands,
17+
subcommands: [
18+
Get.self,
19+
List.self,
20+
Set.self,
21+
Info.self,
22+
FileExtensions.self
23+
],
2624
defaultSubcommand: Get.self
2725
)
2826

@@ -106,7 +104,6 @@ struct TypeCommands: ParsableCommand {
106104
}
107105
}
108106

109-
@available(macOS 11.0, *)
110107
struct FileExtensions: ParsableCommand {
111108
static let configuration
112109
= CommandConfiguration(abstract: "prints the file extensions for the given type identifier")
@@ -124,7 +121,6 @@ struct TypeCommands: ParsableCommand {
124121
}
125122
}
126123

127-
@available(macOS 11.0, *)
128124
struct Info: ParsableCommand {
129125
static let configuration
130126
= CommandConfiguration(abstract: "prints information for the given type identifier")

Sources/utiluti/URLScheme.swift renamed to Sources/utiluti/URLCommands.swift

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ struct URLCommands: ParsableCommand {
1212
static let configuration = CommandConfiguration(
1313
commandName: "url",
1414
abstract: "Manipulate default URL scheme handlers",
15-
subcommands: [ Get.self, List.self, Set.self],
16-
defaultSubcommand: Get.self)
15+
subcommands: [
16+
Get.self,
17+
List.self,
18+
Set.self
19+
],
20+
defaultSubcommand: Get.self
21+
)
1722

1823
struct URLScheme: ParsableArguments {
19-
@Argument(help: ArgumentHelp(
20-
"the url scheme, e.g. 'http' or 'mailto'",
21-
valueName: "scheme"))
24+
@Argument(
25+
help: ArgumentHelp(
26+
"the url scheme, e.g. 'http' or 'mailto'",
27+
valueName: "scheme"
28+
)
29+
)
2230
var value: String
2331
}
2432

Sources/utiluti/utiluti.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ import ArgumentParser
66

77
@main
88
struct UtilUTI: AsyncParsableCommand {
9-
static let subCommands: [ParsableCommand.Type] = [URLCommands.self, TypeCommands.self, GetUTI.self, AppCommands.self, FileCommands.self]
10-
119
static let configuration = CommandConfiguration(
1210
commandName: "utiluti",
1311
abstract: "Read and set default URL scheme and file type handlers.",
1412
version: "1.1dev",
15-
subcommands: subCommands
13+
subcommands: [
14+
URLCommands.self,
15+
TypeCommands.self,
16+
GetUTI.self,
17+
AppCommands.self,
18+
FileCommands.self
19+
]
1620
)
1721
}

0 commit comments

Comments
 (0)