Skip to content

Instantly share code, notes, and snippets.

@gesellix
Forked from thaJeztah/README.md
Created May 6, 2019 15:31
Show Gist options
  • Save gesellix/18f0eaadc70d4b48370045de7e4a5250 to your computer and use it in GitHub Desktop.
Save gesellix/18f0eaadc70d4b48370045de7e4a5250 to your computer and use it in GitHub Desktop.

Revisions

  1. @thaJeztah thaJeztah revised this gist May 4, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ To use it (assuming you're running a beta of Docker 19.03):
    chmod +x ~/.docker/cli-plugins/docker-changelog
    ```

    4. run the `help` command on the nightly docker cli to verify the plugin was installed
    4. run the `help` command to verify the plugin was installed

    ```bash
    docker help
  2. @thaJeztah thaJeztah revised this gist May 4, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ To use it (assuming you're running a beta of Docker 19.03):
    2. download the "plugin", and save it as `~/.docker/cli-plugins/docker-changelog` (note: no `.sh` extension!)

    ```bash
    curl https://gist.github.com/thaJeztah/b7950186212a49e91a806689e66b317d/raw/36d4c5854523502deed5b56842b0d34cd6ec0f70/docker-changelog-plugin.sh > ~/.docker/cli-plugins/docker-changelog
    curl https://gist.github.com/thaJeztah/340fe943e5f0426407eec32e22809ec4/raw/d843dab795c34fb703e780eb221ebe7075e0d3be/docker-changelog-plugin.sh > ~/.docker/cli-plugins/docker-changelog
    ```
    3. make it executable

  3. @thaJeztah thaJeztah created this gist May 4, 2019.
    49 changes: 49 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    ## Docker Changelog CLI plugin

    Based on a [tweet by @Tomwillfixit](https://twitter.com/tomwillfixit/status/1124462492804046848?s=11)

    Just a quick fun conversion to make it work as a Docker CLI plugin

    - https://github.com/docker/cli/issues/1534 CLI Plugins Design
    - https://github.com/docker/cli/pull/1564 Basic framework for writing and running CLI plugins

    To use it (assuming you're running a beta of Docker 19.03):

    1. create the plugins directory

    ```bash
    mkdir -p ~/.docker/cli-plugins
    ```
    2. download the "plugin", and save it as `~/.docker/cli-plugins/docker-changelog` (note: no `.sh` extension!)

    ```bash
    curl https://gist.github.com/thaJeztah/b7950186212a49e91a806689e66b317d/raw/36d4c5854523502deed5b56842b0d34cd6ec0f70/docker-changelog-plugin.sh > ~/.docker/cli-plugins/docker-changelog
    ```
    3. make it executable

    ```bash
    chmod +x ~/.docker/cli-plugins/docker-changelog
    ```

    4. run the `help` command on the nightly docker cli to verify the plugin was installed

    ```bash
    docker help
    ...
    Management Commands:
    app* Docker Application (Docker Inc., v0.8.0-beta1)
    builder Manage builds
    buildx* Build with BuildKit (Docker Inc., v0.2.0-tp)
    changelog* View the Docker Engine changelog (thaJeztah, v0.0.1)
    ```
    5. enjoy!

    ```bash
    docker changelog
    # Changelog
    For official release notes for Docker Engine CE and Docker Engine EE, visit the
    [release notes page](https://docs.docker.com/engine/release-notes/).
    ## 19.03.0 (2019-05-21)
    ```
    28 changes: 28 additions & 0 deletions docker-changelog-plugin.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #!/usr/bin/env bash

    docker_cli_plugin_metadata() {
    local vendor="thaJeztah"
    local version="v0.0.1"
    local url="https://twitter.com/tomwillfixit/status/1124462492804046848?s=11"
    local description="View the Docker Engine changelog"
    cat <<-EOF
    {"SchemaVersion":"0.1.0","Vendor":"${vendor}","Version":"${version}","ShortDescription":"${description}","URL":"${url}"}
    EOF
    }

    version() {
    docker --version | cut -d " " -f 3 | cut -d "," -f 1
    }

    docker_changelog() {
    curl -s "https://raw.githubusercontent.com/docker/docker-ce/v$(version)/CHANGELOG.md" | more
    }

    case "$1" in
    docker-cli-plugin-metadata)
    docker_cli_plugin_metadata
    ;;
    *)
    docker_changelog
    ;;
    esac