Giter Site home page Giter Site logo

commando's People

Contributors

jobala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

profnandaa

commando's Issues

Command Help

Command help is shown when a user adds the --help flag after a command. For Commando, I want to separate concerns between registering commands and command groups and their help information. Developers will define help in help.yaml file then commando will load the file and add help to the commands.

The yaml file should have the following format

parent child grand-child
    type: command
    short-summary: "grand-child help"
    parameters:
      - name: --body
        short-summary: "itemBody"
        long-summary: |
            Usage: --body content=XX content-type=XX
            content: The content of the item.
      - name: --end
        short-summary: "dateTimeTimeZone"
        long-summary: |
            Usage: --end date-time=XX time-zone=XX

Running parent child grand-child --help will result in the output below

usage: parent child grand-child [-h|--help] --body <string> --end <string>

Arguments:

  -h  --help      Print help information
       --body      itemBody
       --end        dateTimeTimeZone

Register Commands

type args struct {
  fname string  `required`
  lname string 
}

func handler(input args) {
    fmt.Printf("%s %s\n", input.fname, input.lname)
}

cli.Command("print", handler, args)
mg print --fname "Hello" --lname "World"
Hello World

Open-sourcing Checklist

  • Add License
  • Add integration test workflow
  • Add issue and pull request template
  • Add getting started section in README.md
  • Add conventional commits GitHub action
  • Add Go CI lint

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.