Skip to content

Instantly share code, notes, and snippets.

@reubenmiller
Last active September 7, 2023 03:22
Show Gist options
  • Save reubenmiller/72d317cd2b0dcce67e0300e86713181e to your computer and use it in GitHub Desktop.
Save reubenmiller/72d317cd2b0dcce67e0300e86713181e to your computer and use it in GitHub Desktop.
Manually install go-c8y-cli just using the binary

Manually download and install the binary

  1. Download the binary

    Linux / MacOS / WSL

    Make sure you choose the appropriate cpu architecture for your machine! Check out the options in the assets section of the latest release.

    mkdir -p "$HOME/bin"
    wget -O "$HOME/bin/c8y" https://github.com/reubenmiller/go-c8y-cli/releases/download/v2.37.0/c8y_linux_arm64 
    chmod +x "$HOME/bin/c8y"
    
    # Add this line to your shell profile
    export PATH="$HOME/bin:$PATH"

    Windows Native (PowerShell)

    mkdir "$HOME/bin"
    Invoke-WebRequest https://github.com/reubenmiller/go-c8y-cli/releases/download/v2.37.0/c8y_windows_amd64.exe -OutFile "$HOME/bin/c8y.exe"
    
    # Add this line to your shell profile ($PROFILE...you may need to create the file/folders)
    $env:PATH = "$HOME/bin;" + $env:PATH
  2. Install default views (via a go-c8y-cli extension, this requires git to be installed!)

    c8y extensions install reubenmiller/c8y-defaults

    If you don't have git installed then you can just download the repository from github.com directly.

    The c8y-defaults folder should be placed in the following folder:

    mkdir -p "$HOME/.cumulocity/extensions"
    
  3. Load the tab completions

    # bash
    source <(c8y completion bash)
    
    # zsh
    autoload -U compinit; compinit
    source <(c8y completion zsh)
    
    # PowerShell
    c8y completion powershell | Out-String | Invoke-Expression

    It helps if add this command in your shell profile so that you don't have to run the command each time you want to use go-c8y-cli.

    For zsh users, you might also want to add the following zsh profile (~/.zshrc) to make the tab completion more readable.

    # zsh styles
    zstyle ':completion:*' menu select
    
    # bind shift+tab to reverse menu complete
    zmodload zsh/complist
    bindkey -M menuselect '^[[Z' reverse-menu-complete
    
  4. Create a new session (only need to do it once)

    c8y sessions create
  5. Activate the session

    # bash
    eval "$(c8y sessions set)"
    
    # zsh
    eval "$(c8y sessions set)"
    
    # PowerShell
    c8y sessions set | out-string | invoke-expression
  6. Start using go-c8y-cli

    c8y devices list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment