Documentation
¶
Index ¶
- Constants
- Variables
- func NewFeedbackCommand(clients *shared.ClientFactory) *cobra.Command
- func ShowFeedbackMessageOnTerminate(ctx context.Context, clients *shared.ClientFactory)
- func ShowSurveyMessages(ctx context.Context, clients *shared.ClientFactory) error
- type Frequency
- type SlackSurvey
- type SurveyConfigInterface
Constants ¶
const ( SlackCLIFeedback = "slack-cli" SlackPlatformFeedback = "slack-platform" SlackPlatformFeedbackDeprecated = "platform-improvements" // DEPRECATED(semver:major) )
Supported survey names
Variables ¶
var SurveyStore = map[string]SlackSurvey{ SlackCLIFeedback: { Name: SlackCLIFeedback, PromptDisplayText: "Slack CLI", PromptDescription: "Questions, issues, and feature requests about the Slack CLI", SkipQueryParams: true, URL: url.URL{ RawPath: "https://github.com/slackapi/slack-cli/issues", }, Info: func(ctx context.Context, clients *shared.ClientFactory) { clients.IO.PrintInfo(ctx, false, "%s\n%s\n", style.Secondary("Ask questions, submit issues, or suggest features for the Slack CLI:"), style.Secondary(style.Highlight("https://github.com/slackapi/slack-cli/issues")), ) }, Ask: func(ctx context.Context, clients *shared.ClientFactory) (bool, error) { clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "love_letter", Text: "We would love to know how things are going", Secondary: []string{ "Share your experience with " + style.Commandf(fmt.Sprintf("feedback --name %s", SlackCLIFeedback), false), }, })) return false, nil }, Frequency: Never, Config: func(clients *shared.ClientFactory) SurveyConfigInterface { return clients.Config.SystemConfig }, }, SlackPlatformFeedback: { Name: SlackPlatformFeedback, PromptDisplayText: "Slack Platform", PromptDescription: "Developer support for the Slack Platform, Slack API, Block Kit, and more", URL: url.URL{RawPath: "https://docs.slack.dev/developer-support"}, Info: func(ctx context.Context, clients *shared.ClientFactory) { clients.IO.PrintInfo(ctx, false, "%s\n%s\n", style.Secondary("You can send us a message at "+style.Highlight(email)), style.Secondary("Or, share your experiences at "+style.Highlight("https://docs.slack.dev/developer-support")), ) }, Ask: func(ctx context.Context, clients *shared.ClientFactory) (bool, error) { clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "love_letter", Text: "We would love to know how things are going", Secondary: []string{ "Share your development experience with " + style.Commandf("feedback", false), }, })) return false, nil }, Frequency: Always, Config: func(clients *shared.ClientFactory) SurveyConfigInterface { return clients.Config.SystemConfig }, }, }
SurveyStore stores all available surveys. New surveys should be added here.
Functions ¶
func NewFeedbackCommand ¶
func NewFeedbackCommand(clients *shared.ClientFactory) *cobra.Command
func ShowFeedbackMessageOnTerminate ¶
func ShowFeedbackMessageOnTerminate(ctx context.Context, clients *shared.ClientFactory)
ShowFeedbackMessageOnTerminate prints a message asking for user feedback when an interrupt signal is received, flushing the ^C ctrl+C character in the process.
func ShowSurveyMessages ¶
func ShowSurveyMessages(ctx context.Context, clients *shared.ClientFactory) error
ShowSurveyMessages displays a message or prompt for feedback for one or more surveys
Types ¶
type Frequency ¶
type Frequency int
Frequency defines how often we want to ask the user to complete the survey
type SlackSurvey ¶
type SlackSurvey struct {
// Name is the survey identifier
Name string
// PromptDisplayText is displayed as the `feedback` command prompt option
PromptDisplayText string
// PromptDescription is displayed beneath the `feedback` command prompt option
PromptDescription string
// SkipQueryParams is a flag to skip adding query params to the survey URL (optional, default false)
SkipQueryParams bool
// URL is the survey URL
URL url.URL
// Config returns either the project-level or system-level survey config
Config func(clients *shared.ClientFactory) SurveyConfigInterface
// Frequency is how often we should ask users to complete the survey
Frequency Frequency
// Info prints additional information about the survey; displayed when the option is selected in `feedback`
// Info is optional
Info func(ctx context.Context, clients *shared.ClientFactory)
// Ask either prints text or prompts the user to complete the survey
// Potentially displayed after `run`/`deploy`/`doctor` (or other places where ShowSurveyMessages is called)
Ask func(ctx context.Context, clients *shared.ClientFactory) (bool, error)
}
func (SlackSurvey) SetAskedAtTimestamp ¶
func (s SlackSurvey) SetAskedAtTimestamp(ctx context.Context, clients *shared.ClientFactory) error
SetAskedAtTimestamp writes a timestamp for when the survey was last asked to the project or system level config
func (SlackSurvey) SetCompletedAtTimestamp ¶
func (s SlackSurvey) SetCompletedAtTimestamp(ctx context.Context, clients *shared.ClientFactory, name string) error
SetCompletedAtTimestamp writes a timestamp for when the survey was asked and completed to the project or system level config
func (SlackSurvey) ShouldAsk ¶
func (s SlackSurvey) ShouldAsk(cfg config.SurveyConfig) (bool, error)
ShouldAsk returns true if we should ask the user the complete the survey