vnugglets / powershellargumentcompleters Goto Github PK
View Code? Open in Web Editor NEWSome work on making Argument Completers for PowerShell cmdlets (like those from VMware PowerCLI)
License: MIT License
Some work on making Argument Completers for PowerShell cmdlets (like those from VMware PowerCLI)
License: MIT License
The argument completers list includes the duplicate values. This can be confusing (is tab-completing "stuck" or something?) and is less than efficient for the consumer.
Please update the completers scriptblock(s) such that only unique completer values are presented.
Example: if two templates are named "myWin2019", only return one in the completers list instead of two, so that tabbing will show just one unique value for that string.
Add some /docs, so that people know more about this project, how to use its goodness, etc.
With the growth of the completers (and the number of AWS cmdlets available), the registering of the completers is approaching 15s in some scenarios.
It would be great to get that back down to a reasonable time (a few seconds).
There are about 20 DynamoDB related cmdlets with the parameter -TableName
, for which it would be handy to include argument completion. Please doit!
Looks like the sbMultipleObjCompleter
scriptblock would be well suited for easily adding this capability to the vNugglets AWS completer registration script Register-VNAWSArgumentCompleter.ps1
For the Register-VNAWSArgumentCompleter.ps1
script, there are a couple of completer scriptblocks that might be serviced by the sbMultipleObjCompleter
completer scriptbock:
sbARNCompleter
sbECRRepositoryCompleter
If possible, consolidate these into the sbMultipleObjCompleter
scriptblock to leverage existing capabilities and simplify code
Make completer values more specific / relevant to the given PowerCLI command in the VMware PowerCLI completers code.
How; if the user has bound value(s) to parameter -Server
, use those in the subsequent "get stuff for completer values" invocation by passing through the -Server
value(s)
An easy / quick add: support for -Group
param for given cmdlets in AWS.Tools.ResourceGroups
module
We need to be able to get these things most easily. Publish the script/module!
The statement that registers argument completers for the parameter Server
for PowerCLI cmdlets can fail if no such cmdlets (modules) loaded.
Should add logic to only register these completers if there are cmdlets for which to register them (duh!)
Some more fine candidates for AWS cmdlet parameters whose values to complete:
RoleArn
(CreateDate, Description)RepositoryName
(CreatedAt, RepositoryUri) for Get-Command -ParameterName RepositoryName -Noun ECR*
RegistryId
(no other interesting property) for Get-Command -ParameterName RegistryId
VpcId
(CidrBlock), and for params EndpointDetails_VpcId
, VPC_VPCId
, VpcConfig_VpcId
, VpcConfiguration_VpcId
, VpcId
, VPCSettings_VpcId
KeyName
for Get-EC2KeyPair
, New-ASLaunchConfiguration
, New-EC2Instance
, Remove-EC2KeyPair
GroupName
(Arn, CreateDate, GroupId) being IAMGroup: cmdlets in AWS.Tools.IdentityManagement
EC2SecurityGroupName
(Description), LaunchSpecification_SecurityGroup
(Description)GroupName
(Description, GroupId, VpcId) being EC2SecurityGroup: Approve-ECCacheSecurityGroupIngress, Enable-RDSDBSecurityGroupIngress, Get-EC2SecurityGroup, Grant-EC2SecurityGroupIngress, Remove-EC2SecurityGroup, Revoke-EC2SecurityGroupIngress, Revoke-ECCacheSecurityGroupIngress, Revoke-RDSDBSecurityGroupIngress, Update-EC2SecurityGroupRuleEgressDescription, Update-EC2SecurityGroupRuleIngressDescriptionGroupName
(Strategy, GroupId) being EC2PlacmentGroup: Edit-EC2InstancePlacement, Get-EC2PlacementGroup, Remove-EC2PlacementGroupGroupId
(Description) for noun EC2*
; and, as suggested in comment below, can type group name for value of word to complete, the completer will get matching SecurityGroups, and present list of SG IDs (with tooltips that include group name)AddSecurityGroupId
, AmazonopensearchserviceDestinationConfiguration_VpcConfiguration_SecurityGroupIds
, AwsvpcConfiguration_SecurityGroup
, Ec2SecurityGroupId
, EndpointDetails_SecurityGroupId
, EngineSecurityGroupId
, ExecutionEngine_MasterInstanceSecurityGroupId
, InputSecurityGroup
, InputSecurityGroupId
, Instances_AdditionalMasterSecurityGroup
, Instances_AdditionalSlaveSecurityGroup
, Instances_EmrManagedMasterSecurityGroup
, Instances_EmrManagedSlaveSecurityGroup
, Instances_ServiceAccessSecurityGroup
, LaunchSpecification_AllSecurityGroup
, LaunchSpecification_SecurityGroupId
, MetricSource_RDSSourceConfig_VpcConfiguration_SecurityGroupIdList
, MetricSource_RedshiftSourceConfig_VpcConfiguration_SecurityGroupIdList
, NetworkConfiguration_SecurityGroupId
, NotebookInstanceSecurityGroupId
, RemoveSecurityGroupId
, SecurityGroup
, SecurityGroupId
, SecurityGroupRuleId
, Vpc_SecurityGroupId
, VpcConfig_SecurityGroupId
, VpcConfiguration_SecurityGroup
, VpcConfiguration_SecurityGroupId
, VPCOptions_SecurityGroupId
, VpcSecurityGroupId
UserName
(CreateDate) for cmdlets in AWS.Tools.IdentityManagement
MetricName
(no ToolTip) for cmdlets in AWS.Tools.CloudWatchLogs
, AWS.Tools.CloudWatch
NameSpace
(no ToolTip) for cmdlets in AWS.Tools.CloudWatchLogs
, AWS.Tools.CloudWatch
Cluster
for cmdlets in AWS.Tools.ECS
AssociationId
for cmdlets in AWS.Tools.SimpleSystemsManagement
PolicyArn
(Description, DefaultVersionId, UpdateDate) for cmdlets in AWS.Tools.IdentityManagement
VaultName
for cmdlets in AWS.Tools.Glacier
FileSystemId
(Name, Encrypted, LifeCycleState, NumberOfMountTargets, calculate Size from SizeInBytes) for cmdlets in AWS.Tools.ElasticFileSystem
, and separate for AWS.Tools.FSx
(properties FileSystemType, Lifecycle, StorageCapacity, StorageType)EventBusName
(ARN)SubnetId
types of things per (Get-Command -ParameterName *subnetid*).Parameters.Keys | Where-Object {$_ -match "subnetid"} | Group-Object
eventually:
DBInstanceIdentifier
for cmdlets in at least AWS.Tools.RDS
There are a couple of ripe targets for some argument completion: Get-AWSCmdletName
and Get-AWSService
. Some suggested params for which to add argument completers:
Cmdlet | ParameterName | Info |
---|---|---|
Get-AWSCmdletName | ApiOperation | Likely get the (nearly complete?) list of available API operations from Get-AWSCmdletName itself |
Get-AWSCmdletName, Get-AWSService | Service | Can get the list of AWS services from Get-AWSService ; should add ServiceName in the completer tooltip |
When showing all completions in PowerShell (by pressing Ctrl + Space
with PSReadline module loaded), include some item-specific ToolTip info. Several are just returning MoRef values at the moment.
Some ideas for more useful info in the ToolTip:
Implemented | Cmdlet/focus | Param | ToolTip Value |
---|---|---|---|
✅ | Get-VMHost | -Name | ConnectionState, PowerState |
✅ | Get-Datastore, Get-DatastoreCluster | -Name | FreeSpaceGB/CapacityGB |
✅ | Get-Template | -Name | .ExtensionData.Config.GuestFullName |
✅ | Get-OSCustomizationSpec | -Name | OSType |
(updating "Implemented" properties here as code is updated)
Add completers for other cmdlet params not already covered, like Get-VirtualNetwork -Name
. Need to validate to which other cmdlets/params to expand
Wouldn't it be nice to add some tab-completion to some params for ActiveDirectory module cmdlets? A: Yes, it would!
Some spots at which to add them:
-Properties
-- property names for Get-AD[User|Group|Computer|OrganizationalUnit] cmdlets
SearchBase
, TargetPath
: all cmdlets with these paramsPath
param: New-ADComputer
, New-ADGroup
, New-ADObject
, New-ADOrganizationalUnit
, New-ADServiceAccount
, New-ADUser
Identity
for
(Get-Command -Module ActiveDirectory -ParameterName identity -Noun *orga*)
Get-ADGroup
, Remove-ADGroup
, Set-ADGroup
*-ADGroupMember
The tab-completed values for parameters should be enclosed in quotes if the value has given characters, like a space or a dollar sign. This should probably be single quotes, for the sake of making a literal value, instead of something that might get further interpreted by the shell.
Example: default vSphere VM named vCLS (1)
should result in a tab-completion value of 'vCLS (1)'
While the #8 details the things for the latest update to the script, the docs/ChangeLog.md should include such info for posterity, too.
Add the change info to said ChangeLog.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.