Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 662 Bytes

README.md

File metadata and controls

40 lines (27 loc) · 662 Bytes

Hello Cobra CLI

It's really simple CLI application example using Cobra library

Cobra CLI example

Prerequisites:
Go 1.16+ for building the binary
Go 1.16+ for running the test suite
Cobra v1.1+ for initializing commands

Tutorial

To start cobra project from scratch

cobra init --config .cobra.yaml --pkg-name github.com/anitabee/exploring-go/hello-cobra-cli

To add new command

cobra add hello --config .cobra.yaml

Build app

go build -o cli -ldflags="-w -s" 

Run cli tool

// Unix like systems
./cli hello

// Windows systems
cli.exe hello