import ( "github.com/mitchellh/packer/packer/ui" ) func main() { // instantiate a new Ui ui := new(ui.BasicUi) // display the build progress ui.Say("Building machine image...") ui.Message("Step 1/3: Creating temporary directory...") ui.Message("Step 2/3: Provisioning machine...") ui.Message("Step 3/3: Generating image...") ui.Say("Build complete!") }
import ( "github.com/mitchellh/packer/packer/ui" ) func main() { // instantiate a new Ui ui := new(ui.BasicUi) // prompt the user for input input := ui.Ask("What's your name? ") ui.Say("Hello, " + input + "!") }This example shows how to use the Ui package to prompt the user for input and display a personalized greeting based on their response.