Giter Site home page Giter Site logo

vnugglets / powershellargumentcompleters Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 0.0 1.13 MB

Some work on making Argument Completers for PowerShell cmdlets (like those from VMware PowerCLI)

License: MIT License

PowerShell 100.00%
argumentcompleter powercli powershell tab-completion vmware

powershellargumentcompleters's People

Contributors

mtboren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

powershellargumentcompleters's Issues

Add more AWS completers

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

Docs! We need them

Add some /docs, so that people know more about this project, how to use its goodness, etc.

Update Intellisense ToolTip value for various types to be more useful

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 support for leveraging -Server param in PowerCLI completers if bound

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)

Speed up AWS Completers registering

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).

Add more PowerCLI completers

Add completers for other cmdlet params not already covered, like Get-VirtualNetwork -Name. Need to validate to which other cmdlets/params to expand

Enhancement Request: provide only the unique completions (vs. all with duplicate)

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 more completers for AWS modules

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
  • Low value for the amount it load time it takes, skipping for this update:
    • 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-EC2SecurityGroupRuleIngressDescription
    • GroupName (Strategy, GroupId) being EC2PlacmentGroup: Edit-EC2InstancePlacement, Get-EC2PlacementGroup, Remove-EC2PlacementGroup
  • GroupId (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)
  • Other EC2ScurityGroup things, but disabled for now (commented out), due to possibly minimal value vs. the cost of 10-20% extra load time: 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

Add completers for ActiveDirectory module cmdlets

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
    • should work from both non-domain joined machine and domain-joined machine
  • OUs:
    • SearchBase, Path, TargetPath
      • SearchBase, TargetPath: all cmdlets with these params
      • Path 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

Optimize: Consolidate completer scriptblocks

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.