Socket
Book a DemoInstallSign in
Socket

idontfixcomputers.com/cliche

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idontfixcomputers.com/cliche

v0.0.0-20231207201528-a80d97c26552
Go
Version published
Created
Source

cliche: Simple CLIs for Go

//go:generate TODO(christian)
type Hello struct {
    Name string
}

func (h *Hello) Run(ctx context.Context, out io.Writer) error {
    fmt.Fprintf(out, "Hello, %v!", h.Name)
}

After running go generate and go build, there is now a hello command:

$ hello -name=World
Hello, World!
...
//go:generate TODO(christian)
type Hello struct {
    Name string `cli:"arg"`
}

func (h *Hello) Run(ctx context.Context, out io.Writer) error {
    fmt.Fprintf(out, "Hello, %v!", h.Name)
}
$ hello World
Hello, World!
...
//go:generate TODO(christian)
type Hello struct {
    Name string `cli:"default:World"`
}

func (h *Hello) Run(ctx context.Context, out io.Writer) error {
    fmt.Fprintf(out, "Hello, %v!", h.Name)
}
$ hello World
Hello, World!
...
//go:generate TODO(christian)
type Hello struct {
    Name string `cli:"flag;default:World"`
}

func (h *Hello) Run(ctx context.Context, out io.Writer) error {
    fmt.Fprintf(out, "Hello, %v!", h.Name)
}
$ hello World
Hello, World!
...

FAQs

Package last updated on 07 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.