cli

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: Apache-2.0 Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

cli application examples

Integrate with promptui

It's easy to integrate promptui into Hiboot cli application

// declare main package
package main

// import cli starter and fmt
import (
	"hidevops.io/hiboot/pkg/starter/cli"
	"github.com/manifoldco/promptui"
	"fmt"
)

// define the command
type PromptuiCommand struct {
	cli.RootCommand
}

// Init constructor
func (c *PromptuiCommand) Init() {
	c.Use = "promptui"
	c.Short = "promptui command"
	c.Long = "run promptui command for getting started"

}

// Run run the command
func (c *PromptuiCommand) Run(args []string) error {
	// define selections
	prompt := promptui.Select{
		Label: "Select Day",
		Items: []string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"},
	}

    // call prompt.Run() to get users selection
	_, result, err := prompt.Run()

	if err != nil {
		fmt.Printf("Prompt failed %v\n", err)
		return fmt.Errorf("Prompt failed %v\n", err)
	}

	fmt.Printf("You choose %q\n", result)

	return nil
}

// main function
func main() {
	// create new cli application and run it
	cli.NewApplication(new(PromptuiCommand)).Run()
}

Documentation

Overview

Package cli provides hiboot command line application examples

Directories

Path Synopsis
cmd
cmd

Jump to

Keyboard shortcuts

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