From 7beeeb3e60b0c4d16aa956e2438110a93079c474 Mon Sep 17 00:00:00 2001 From: alec aivazis Date: Wed, 26 Apr 2017 17:17:26 -0700 Subject: [PATCH 1/5] added section in readme for help text --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/README.md b/README.md index ccf816ff..7e270bff 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,43 @@ validators include: | MinLength(n) | string | Enforces that a response is at least the given length | | MaxLength(n) | string | Enforces that a response is no longer than the given length | +## Help Text +All of the prompts have a `Help` field which can be defined to provide more information to your users: + + +```golang +&survey.Input{ + Message: "What is your phone number:", + Help: "Phone number should include the area code", +} +``` + +### Changing the input rune + +In some situations, `?` is a perfectly valid response. To handle this, you can change the rune that survey +looks for by setting the `HideInputRune` variable in `survey/core`: + +```golang + +import ( + "gopkg.in/AlecAivazis/survey.v1" + surveyCore "gopkg.in/AlecAivazis/survey.v1/core" +) + +number := "" +prompt := &survey.Input{ + Message: "If you have this need, please give me a reasonable message.", + Help: "I couldn't come up with one.", +} + +surveyCore.HideInputRune = '^' + +survey.AskOne(prompt, &number, nil) +``` + +## Customizing Output + + ## Versioning This project tries to maintain semantic GitHub releases as closely as possible. As such, services From 00c7a969e5994aa3d7e82dfd88f62cdb5afde4fa Mon Sep 17 00:00:00 2001 From: alec aivazis Date: Wed, 26 Apr 2017 17:59:06 -0700 Subject: [PATCH 2/5] added section in readme for changing icons --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 7e270bff..7dc7fa76 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ func main() { ``` ## Examples + Examples can be found in the `examples/` directory. Run them to see basic behavior: ```bash @@ -67,6 +68,7 @@ go run examples/validation.go ## Prompts ### Input + ```golang @@ -79,6 +81,7 @@ survey.AskOne(prompt, &name, nil) ### Password + ```golang @@ -91,6 +94,7 @@ survey.AskOne(prompt, &password, nil) ### Confirm + ```golang @@ -103,6 +107,7 @@ survey.AskOne(prompt, &name, nil) ### Select + ```golang @@ -116,6 +121,7 @@ survey.AskOne(prompt, &color, nil) ### MultiSelect + ```golang @@ -147,6 +153,7 @@ q := &survey.Question{ ``` ### Built-in Validators + `survey` comes prepackaged with a few validators to fit common situations. Currently these validators include: @@ -157,6 +164,7 @@ validators include: | MaxLength(n) | string | Enforces that a response is no longer than the given length | ## Help Text + All of the prompts have a `Help` field which can be defined to provide more information to your users: @@ -190,8 +198,23 @@ surveyCore.HideInputRune = '^' survey.AskOne(prompt, &number, nil) ``` + ## Customizing Output +Customizing the icons and various parts of survey can easily be done by setting the following variables +in `survey/core`: + +| name | default | description | +|------------------------|----------------|-------------------------------------------------------| +| ErrorIcon | ✘ | Before an error | +| HelpIcon | ⓘ | Before help text | +| QuestionIcon | ? | Before the message of a prompt | +| SelectFocusIcon | > | Marks the current selection in a `Select` prompt | +| MarkedOptionIcon | ◉ | Marks a chosen selection in a `MultiSelect` prompt | +| UnmarkedOptionIcon | ◯ | Marks an unselected option in a `MultiSelect` prompt | +| MultiSelectFocusIcon | ❯ | Marks the current selection in a `MultiSelect` prompt | + + ## Versioning From f6f5e1d8d2147c6d586aac18a6dc2855d2d3815a Mon Sep 17 00:00:00 2001 From: alec aivazis Date: Wed, 26 Apr 2017 18:15:32 -0700 Subject: [PATCH 3/5] updated readme since select and multi select focus always have the same icon --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7dc7fa76..9e80969f 100644 --- a/README.md +++ b/README.md @@ -204,15 +204,14 @@ survey.AskOne(prompt, &number, nil) Customizing the icons and various parts of survey can easily be done by setting the following variables in `survey/core`: -| name | default | description | -|------------------------|----------------|-------------------------------------------------------| -| ErrorIcon | ✘ | Before an error | -| HelpIcon | ⓘ | Before help text | -| QuestionIcon | ? | Before the message of a prompt | -| SelectFocusIcon | > | Marks the current selection in a `Select` prompt | -| MarkedOptionIcon | ◉ | Marks a chosen selection in a `MultiSelect` prompt | -| UnmarkedOptionIcon | ◯ | Marks an unselected option in a `MultiSelect` prompt | -| MultiSelectFocusIcon | ❯ | Marks the current selection in a `MultiSelect` prompt | +| name | default | description | +|------------------------|----------------|-------------------------------------------------------------------| +| ErrorIcon | ✘ | Before an error | +| HelpIcon | ⓘ | Before help text | +| QuestionIcon | ? | Before the message of a prompt | +| MultiSelectFocusIcon | ❯ | Marks the current selection in `Select` and `MultiSelect` prompts | +| MarkedOptionIcon | ◉ | Marks a chosen selection in a `MultiSelect` prompt | +| UnmarkedOptionIcon | ◯ | Marks an unselected option in a `MultiSelect` prompt | From 772a08af3da74f584dfb889ffb1c99ba79e76d95 Mon Sep 17 00:00:00 2001 From: alec aivazis Date: Wed, 26 Apr 2017 18:24:20 -0700 Subject: [PATCH 4/5] fixed typo in icon table --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9e80969f..282d0528 100644 --- a/README.md +++ b/README.md @@ -204,14 +204,14 @@ survey.AskOne(prompt, &number, nil) Customizing the icons and various parts of survey can easily be done by setting the following variables in `survey/core`: -| name | default | description | -|------------------------|----------------|-------------------------------------------------------------------| -| ErrorIcon | ✘ | Before an error | -| HelpIcon | ⓘ | Before help text | -| QuestionIcon | ? | Before the message of a prompt | -| MultiSelectFocusIcon | ❯ | Marks the current selection in `Select` and `MultiSelect` prompts | -| MarkedOptionIcon | ◉ | Marks a chosen selection in a `MultiSelect` prompt | -| UnmarkedOptionIcon | ◯ | Marks an unselected option in a `MultiSelect` prompt | +| name | default | description | +|---------------------|----------------|-------------------------------------------------------------------| +| ErrorIcon | ✘ | Before an error | +| HelpIcon | ⓘ | Before help text | +| QuestionIcon | ? | Before the message of a prompt | +| SelectFocusIcon | ❯ | Marks the current selection in `Select` and `MultiSelect` prompts | +| MarkedOptionIcon | ◉ | Marks a chosen selection in a `MultiSelect` prompt | +| UnmarkedOptionIcon | ◯ | Marks an unselected option in a `MultiSelect` prompt | From a7497d9cd88d47397a0e6be5e04eaef7138f1b4d Mon Sep 17 00:00:00 2001 From: alec aivazis Date: Wed, 26 Apr 2017 18:26:16 -0700 Subject: [PATCH 5/5] added caveat to help text section --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 282d0528..3491610d 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ validators include: ## Help Text -All of the prompts have a `Help` field which can be defined to provide more information to your users: +All of the prompts (except `Password`) have a `Help` field which can be defined to provide more information to your users: ```golang