Skip to content

ProfessorManhattan/go-cli-template

Repository files navigation

Go CLI Starting Template



Same as description but only shows up in the README and allows special characters


Table of Contents

Overview

This project is a boilerplate for Go CLI projects. It includes common files that are shared throughout the Megabyte Labs ecosystem. It also includes a basic project structure. It does not attempt to dictate project structure - it just takes care of all the meta-tasks like configuring CI, linters, and build tools.

Go CLI Boilerplate

This repository is home to a Go CLI boilerplate / template that should be used as a starting point for Go CLI projects. It includes all the common files that are shared across Megabyte Labs projects along with some Go-specific configurations.

Installation

There are several ways you can install this CLI. You can:

  1. Use our bash scripts which will handle everything automatically with as few dependencies as possible
  2. Compile the program using Go and add it to your PATH
  3. Install it via an NPM convienience wrapper
  4. Download the pre-built binary from the GitLab or GitHub releases page and then place it in your PATH

Quick Method

If you are looking to install the CLI as quickly as possible then you can run the following script which will install the binary to your /usr/local/bin folder on macOS or Linux:

curl -sS https://install.doctor/null | bash

Or, if you are on Windows, you can install it by running:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://install.doctor/null?os=win'))

Compile Program with Go

You can install the CLI by compiling it from the source as long as you have a recent version of Go installed:

git clone https://github.com/megabyte-labs/go-cli-template.git
cd {{#withLast (split repository.github "/")}}this/withLast
null
sudo mv null /usr/local/bin

After you compile the program, you should then move the binary file to a location that is in your PATH (which is what the last line does in the snippet above).

NPM Install Method

Every release is bundled into an NPM package that you can install by running the following command:

npm install -g null

Pre-Built Binary

If you trust us (and you should not.. trust.. anybody.. EVER), then you can also download the binary directly from the Go CLI GitLab release page or the GitHub release page. After you download the release, you will have to either place the binary somewhere in your PATH or run the installer (in the case of the .deb or .rpm releases, for instance).

Usage

All of the usage instructions can be found by running null --help. After running the command, you should be greeted with the following output:

help_menu_output

Man Page

Alternatively, if you installed the package via NPM or an installer that set up the man page (e.g. .deb or .rpm), then you can find usage instructions by running man null.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page. If you would like to contribute, please take a look at the contributing guide.

Sponsorship

Dear Awesome Person,

I create open source projects out of love. Although I have a job, shelter, and as much fast food as I can handle, it would still be pretty cool to be appreciated by the community for something I have spent a lot of time and money on. Please consider sponsoring me! Who knows? Maybe I will be able to quit my job and publish open source full time.

Sincerely,

Brian Zalewski

Open Collective sponsors GitHub sponsors Patreon

License

Copyright © 2020-2021 Megabyte LLC. This project is MIT licensed.