Coder Social home page Coder Social logo

dockercompletion's Introduction

DockerCompletion for PowerShell

demo

Completion for

  • Management commands and subcommands
    • container, image, service, ...
  • Legacy commands
    • create, images, ps, ...
  • Command/Option arguments
    • run [image], container inspect [container], ...
    • --filter [key=value], --logDriver [name], ...

All of the completions are customizable.

Requirements

  • PowerShell >= 5.0
  • docker cli >= 1.13 in $env:PATH

Quick Start

# Install from PowerShell Gallery
Install-Module DockerCompletion -Scope CurrentUser
# Import
Import-Module DockerCompletion

Less Quick Start (without Install-Module)

DockerCompletion is a "well-formed" module. You can install and import it in the usual manner as follows.

Install

Download and place the DockerCompletion directory and files in $env:PSModulePath.

You can see the paths listed in $env:PSModulePath as follows:

PS C:\> $env:PSModulePath -split ';'
C:\Users\matt9ucci\Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

If your target path is C:\Users\matt9ucci\Documents\WindowsPowerShell\Modules, execute the following commands:

# Uninstall previous version
Remove-Item $HOME\Documents\WindowsPowerShell\Modules\DockerCompletion -Recurse -Force
# Download
Invoke-WebRequest https://github.com/matt9ucci/DockerCompletion/archive/master.zip -OutFile master.zip
# Unzip the downloaded archive
Expand-Archive master.zip
# Place the unzipped files and directory in $env:PSModulePath
Move-Item master\DockerCompletion-master\DockerCompletion "$HOME\Documents\WindowsPowerShell\Modules"
# Clean up
Remove-Item master.zip
Remove-Item master -Recurse -Force

$HOME is a PowerShell's automatic variable containing the full path of the user's home directory (in this case C:\Users\matt9ucci).

Import

Execute the following command to check if you can import DockerCompletion:

PS C:\> Get-Module -ListAvailable DockerCompletion

    Directory: C:\Users\matt9ucci\Documents\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.1708.... DockerCompletion

After the check, execute the following command to import the installed module:

Import-Module DockerCompletion

Customization

You can add your own completers and modify default completers with your custom script.

For information about how to write custom scripts, see completers.ps1 and completers4arguments.ps1

To apply your custom script, pass the path as Import-Module's ArgumentList parameter:

Import-Module DockerCompletion -ArgumentList pathto\custom1.ps1, pathto\custom2.ps1

Known Issues

In PowerShell 5.0/5.1, with one dash (-) and double dash (--), completers are not invoked because of a PowerShell's bug. It will be fixed in PowerShell 6.0.

A workaround for this issue is to type a character following - and --. For example, type --a and press tab.

Misc

This github repository will be often rebased.

Links

dockercompletion's People

Contributors

giggio avatar matt9ucci avatar

Watchers

 avatar

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.