File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 1+ //
2+ // File.swift
3+ // utiluti
4+ //
5+ // Created by Armin on 25/03/2025.
6+ //
7+
8+ import Foundation
Original file line number Diff line number Diff line change @@ -14,18 +14,23 @@ struct GetUTI: ParsableCommand {
1414 static let configuration
1515 = CommandConfiguration ( abstract: " Get the type identifier (UTI) for a file extension " )
1616
17- @Argument ( help: " file extension " ) var fileExtension : String
17+ @Argument ( help: " file extension " )
18+ var fileExtension : String
19+
20+ @Flag ( help: " show dynamic identifiers " )
21+ var showDynamic = false
1822
1923 func run( ) {
2024 guard let utype = UTType ( filenameExtension: fileExtension) else {
2125 Self . exit ( withError: ExitCode ( 3 ) )
2226 }
2327
2428 if utype. identifier. hasPrefix ( " dyn. " ) {
25- print ( " <unknown extension> " )
26- Self . exit ( withError: ExitCode ( 1 ) )
29+ if showDynamic {
30+ print ( utype. identifier)
31+ }
32+ } else {
33+ print ( utype. identifier)
2734 }
28-
29- print ( utype. identifier)
3035 }
3136}
You can’t perform that action at this time.
0 commit comments