Giter Site home page Giter Site logo

bergmeister / posh-vsts-cli Goto Github PK

View Code? Open in Web Editor NEW
14.0 5.0 1.0 97 KB

PowerShell tab completion and object conversion of the vsts-cli

License: GNU General Public License v3.0

PowerShell 100.00%
powershell powershell-module posh vsts cli tabcompletion

posh-vsts-cli's Introduction

posh-vsts-cli Build status AppVeyor tests codecov PSScriptAnalyzer License: GPL v3

A PowerShell helper that enhances the vsts-cli with

  • Tab completion
  • Conversion of the JSON or table output to a PowerShell object by providing the Convert-FromVstsCli command
  • Wrapping the call to the vsts command and the object conversion in the iv command alias
  • Installing the vsts-cli

Subgroup and command tab completion Subgroup and command tab completion

Installation

Install it from the PSGallery:

if ($PSVersionTable.PSVersion.Major -ge 5) {
    Install-Module posh-vsts-cli -Force
}
else {
    Install-Module TabExpansionPlusPlus -Force
    Install-Module posh-vsts-cli -Force
}
Import-Module posh-vsts-cli

If you have not already installed the vsts-cli, then you can use the following function of posh-vsts-cli, which uses the official installer from here:

Install-VstsCli

Alternatively you can also just clone/download this repo and import the posh-vsts-cli.psd1 module.

Usage

You can invoke the VSTS CLI directly via Invoke-VstsCli or its alias iv and the output gets converted to PowerShell objects.

> $builds = iv build list --top 3 --output table
> $builds[2] # show the object properties of the third build
DefinitionName : My VSTS build
Id             : 199
Number         : 0.1.0+113
SourceBranch   : master
Reason         : individualCI
Result         : partiallySucceeded
Status         : completed
DefinitionId   : 3
QueuedTime     : 2017-10-01 22:41:02.456000
> $builds[2].Result # you can get at all those properties individually as well
partiallySucceeded

Under the hood the vsts cli gets called and then the output gets convertedd to a PowerShell object. It auto-detects if the output was in JSON or table format.

> $builds = vsts build list --top 3 | ConvertFrom-VstsCli

The output conversion is currently only tested for the build commands of the VSTS CLI using Windows PowerShell 5.1 and PowerShell Core 6.0-rc but should work with others as well and with PowerShell versions down to 3.0.

Tab Completion

Tab completion already works for groups (e.g. vstst build), commands (e.g. vsts build list) and options (e.g. vsts build list --top). Tab completion is available for the vsts and the iv commands and commands. The first time you use it in a new shell, you need to press tab twice and give it a second to initialize but after that just one tab completes the current command.

>vsts <TAB><TAB>
>vsts build
>vsts build <TAB>
>vsts build list
>vsts build list <TAB>
>vsts build queue
>vsts build queue --d <TAB>
>vsts build queue --detect
>vsts build queue --detect <TAB>
>vsts build queue --instance

It is intended to add future support on available entities (e.g. vsts build queue --definition-name to tab complete the available definition names).

posh-vsts-cli's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

flcdrg

posh-vsts-cli's Issues

Tab completion

This is currently work in progress in a branch.
It will be based on a similar concept that posh-docker uses. Feel free to help.

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.