go-cobra-cli

command module
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 10 Imported by: 0

README

go-cobra-cli

[[TOC]]

Overview

go-cobra-cli is a full, working implementation of a go cli application; the following project is a template that can be forked, copied for private or personal usage.

The remaining README.md's contents is for non-template usage. Of course, replace section(s) where appropriate -- namely go-cobra-cli and VCS references.

Getting Started

Installing
brew tap iac-factory/homebrew-taps

# --> GitLab Private Configuration Example
# brew tap ethr/homebrew-go-cobra-cli-tap [email protected]:ethrgg/templates/homebrew-go-cobra-cli-tap

# brew install iac-factory/taps/go-cobra-cli --verbose --debug

# --> Simplified
brew install go-cobra-cli
Upgrading
brew update && brew upgrade go-cobra-cli
Reinstalling
brew update
brew unlink go-cobra-cli
brew install go-cobra-cli
Pre-Commit
  1. Install pre-commit from https://pre-commit.com/#install

  2. Create a .pre-commit-config.yaml file at the root of the repository with the following content:

    repos:
      - repo: https://github.com/gitleaks/gitleaks
        rev: latest
        hooks:
          - id: gitleaks
    
  3. Auto-update the config to the latest repos' versions by executing pre-commit autoupdate

  4. Install with pre-commit install


Deployment & Initial Setup (Maintainers)

The following section is intended only for project maintainers & developers.

  • Please see the getting started section for installation and upgrade instructions.
  1. Install goreleaser if it isn't installed

    brew install goreleaser/tap/goreleaser
    
  2. Initialize the repository for new repositories

    goreleaser init
    
  3. Test the snapshot without VCS deployment

    goreleaser release --snapshot --clean
    
  4. Configure the default system's local gitlab_token or github_token secret

    mkdir -p ~/.config/goreleaser && touch ~/.config/goreleaser/gitlab_token
    mkdir -p ~/.config/goreleaser && touch ~/.config/goreleaser/github_token
    
  5. Commit and push to VCS

    git add . && git commit -m "CI - Example" && git push
    
  6. List git tags to get a version that isn't already established

    git tag --list
    
  7. Using the output from above, increment the version and push a new tag

    git tag -a v0.0.1 -m "Bump: Initial Release" && git push origin v0.0.1
    
  8. Create and push a new release

    goreleaser release --clean
    
  9. Update local Formula to include the new tag (only applicable for private projects)

    sed -i -e "s/using: GitDownloadStrategy/using: GitDownloadStrategy, tag: \"$(git tag --points-at HEAD)\"/g" ./dist/homebrew/Formula/go-cobra-cli.rb
    
  10. Copy the updated Formula to system clipboard (only applicable for private projects)

    cat ./dist/homebrew/Formula/go-cobra-cli.rb | pbcopy
    
  11. Update the Homebrew Tap's *.rb file with clipboard's contents (only applicable for private projects)

  12. Tap the repository using git+ssh protocol (only applicable for private repositories)

    brew tap iac-factory/homebrew-taps [email protected]:iac-factory/homebrew-taps
    
  13. Update the Cask if already established

    brew update
    
  14. Install the package (see the installation section)

Reference(s)

Useful Command(s)

Tags

# --> Delete Remote Tag
git push origin --delete v0.0.0

# --> HEAD Tag
git tag --points-at HEAD

SSH Agent

eval "$(ssh-agent -s)"

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
commands/example
Package example provides an example cli sub-command.
Package example provides an example cli sub-command.
log
Package log provides module-level logging capabilities for interacting with go standard-library's log/slog package.
Package log provides module-level logging capabilities for interacting with go standard-library's log/slog package.
log/color
Package color provides ANSI color codes for output formatting.
Package color provides ANSI color codes for output formatting.
types/level
Package level represents a cli-flag type for setting log-level.
Package level represents a cli-flag type for setting log-level.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL