I’m using Autorest to generate PowerShell cmdlets and I want to implement argument completion for a parameter dynamically using another cmdlet (e.g., Get-BsnOsmCliNSinstance).
I’ve read about using directives in Autorest and tried setting a completer like this in my configuration.yaml:
This is my script :
input-file: osm-openapi.yaml
directive:
- where:
verb: Get
subject: BsnOsmCliNsi
parameter-name: NetsliceInstanceId
set:
completer:
name: NetsliceInstanceId Completer
description: Dynamically retrieves NetsliceInstanceIds from Get-BsnOsmCliNSinstance for tab completion.
script: "(Get-BsnOsmCliNSinstance | ForEach-Object { $_.Id })"
or
input-file: osm-openapi.yaml
directive:
- where:
verb: Get
subject: BsnOsmCliNsi
parameter-name: NetsliceInstanceId
set:
completer:
name: NetsliceInstanceId Completer
description: Dynamically retrieves NetsliceInstanceIds for tab completion.
script: "'westus2', 'centralus', 'global'"
My Expectation : Get-BsnOsmCliNsi -NetsliceInstanceId