Here is my sample code:
extension URL: ExpressibleByArgument {
public init?(argument: String) {
guard let url = URL(string: argument) else {
return nil
}
self = url
}
}
struct MySample: ParsableCommand {
@Option(default: URL(string: FileManager.default.currentDirectoryPath)!, help: "Directory")
var directory: URL
}
Produces output:
USAGE: sample [--directory <directory>]
OPTIONS:
-v, --version Print version
--directory <directory> Directory (default:
/Users/stewie/Library/Developer/Xcode/DerivedData/sample-blghzaivmncuwahbbafbmsweltpy/Build/Products/Debug)
-h, --help Show help information.
Expected behavior
I would expect the following
--directory <directory> Directory (default: current directory)
Actual behavior
I get:
--directory <directory> Directory (default:
/Users/stewie/Library/Developer/Xcode/DerivedData/sample-blghzaivmncuwahbbafbmsweltpy/Build/Products/Debug)
defaultValueDescription
is implemented at this commit
I would get my expected behavior if I can override this computed property, but I don't know how to do that.
Anyone have an idea?
Environment
ArgumentParser: HEAD.