You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment the custom case of the CompletionKind enumeration supports being given a custom closure to generate completions on the command line. However, since the provided closure must be synchronous, it is difficult to incorporate functionality that requires swift's concurrency features. The lack of this functionality prevents certain tasks from being possible with these completions and causes other tasks to be possible, but only in a non-thread safe way. Examples of this include working with databases (such as those managed by Apple's Core Data framework).
Example:
structSomeCommand:AsyncParseableCommand{@Argument(help:"<Helpful help>", completion:.custom({ arguments inreturntry?awaitcompletionGenerator(arguments: arguments)??[]}))varargument:Stringmutatingfunc run()asyncthrows{// Code that makes the command Run}}@MainActorprivatefunc completionGenerator(arguments:[String])asyncthrows->[String]{// Code that generates completions that has some asynchronous system in use and/or must be run on the main actor.}
The text was updated successfully, but these errors were encountered:
At the moment the
custom
case of theCompletionKind
enumeration supports being given a custom closure to generate completions on the command line. However, since the provided closure must be synchronous, it is difficult to incorporate functionality that requires swift's concurrency features. The lack of this functionality prevents certain tasks from being possible with these completions and causes other tasks to be possible, but only in a non-thread safe way. Examples of this include working with databases (such as those managed by Apple's Core Data framework).Example:
The text was updated successfully, but these errors were encountered: