Skip to content

InkShaStudio/go-command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Command

A wrapper library for Cobra CLI framework.

Install

go get -u github.com/InkShaStudio/go-command

Usage

package main

import (
  "fmt"
  "os"

  "github.com/InkShaStudio/go-command"
)

func main() {
  world := command.
    NewCommand("world").
    ChangeDescription("hello world").
    RegisterHandler(func(cmd *command.SCommand) {
      fmt.Println("Hello World")
    })

  cmd := command.RegisterCommand(
    command.
      NewCommand("hello").
      ChangeDescription("hello world").
      RegisterHandler(func(cmd *command.SCommand) {
      }).
      AddSubCommand(
        world,
      ),
  )
  if err := cmd.Execute(); err != nil {
    fmt.Println(err)
    os.Exit(1)
  }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages