Dagger
Search

prompt

A prompt for manual user input

Example (Input)
no available example in current language
// Prompt_Input is a function that demonstrates how to use the Prompt() function
func (m *Examples) Prompt_Input() string {

	result := dag.Prompt().
		WithMsg("Do you want to continue? (y/n)"). // A custom message for the prompt
		WithInput("yes").                          // pass in from the ci pipeline
		WithMatch("y").                            // A custom regex match for the user input
		WithCi(false).                             // disabled ci mode will open a terminal prompt
		Execute()

	outcome, _ := result.Outcome(context.Background()) // true or false if input matched the regex
	input, _ := result.Input(context.Background())     // The user input

	return "Outcome: " + strconv.FormatBool(outcome) + ", Input: " + input

}
no available example in current language
no available example in current language
Example (Choice)
no available example in current language
// Prompt_Choice is a function that demonstrates how to use the Prompt() function
func (m *Examples) Prompt_Choice() string {

	result := dag.Prompt().
		WithChoices([]string{"Option 1", "Option 2", "Option 3"}). // A list of custom choices
		WithMsg("Select an option").                               // A custom message for the prompt
		WithInput("Option 2").                                     // pass in from the ci pipeline
		WithCi(false).                                             // disabled ci mode will open a terminal prompt
		Execute()

	outcome, _ := result.Outcome(context.Background()) // true or false if input was a valid choice
	input, _ := result.Input(context.Background())     // The selected choice

	return "Outcome: " + strconv.FormatBool(outcome) + ", Input: " + input
}
no available example in current language
no available example in current language

Installation

dagger install github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f

Entrypoint

Return Type
Prompt !
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
func (m *MyModule) Example() *dagger.Prompt  {
	return dag.
			Prompt()
}
@function
def example() -> dagger.Prompt:
	return (
		dag.prompt()
	)
@func()
example(): Prompt {
	return dag
		.prompt()
}

Types

Options 🔗

ci() 🔗

Return Type
Boolean !
Example
Function PromptOptions.ci is not accessible from the prompt module
Function PromptOptions.ci is not accessible from the prompt module
Function PromptOptions.ci is not accessible from the prompt module
Function PromptOptions.ci is not accessible from the prompt module

msg() 🔗

Return Type
String !
Example
Function PromptOptions.msg is not accessible from the prompt module
Function PromptOptions.msg is not accessible from the prompt module
Function PromptOptions.msg is not accessible from the prompt module
Function PromptOptions.msg is not accessible from the prompt module

input() 🔗

Return Type
String !
Example
Function PromptOptions.input is not accessible from the prompt module
Function PromptOptions.input is not accessible from the prompt module
Function PromptOptions.input is not accessible from the prompt module
Function PromptOptions.input is not accessible from the prompt module

match() 🔗

Return Type
String !
Example
Function PromptOptions.match is not accessible from the prompt module
Function PromptOptions.match is not accessible from the prompt module
Function PromptOptions.match is not accessible from the prompt module
Function PromptOptions.match is not accessible from the prompt module

choices() 🔗

Return Type
[String ! ] !
Example
Function PromptOptions.choices is not accessible from the prompt module
Function PromptOptions.choices is not accessible from the prompt module
Function PromptOptions.choices is not accessible from the prompt module
Function PromptOptions.choices is not accessible from the prompt module

withChoices() 🔗

Return Type
Options !
Arguments
NameTypeDefault ValueDescription
choices[String ! ] !-No description provided
Example
Function PromptOptions.withChoices is not accessible from the prompt module
Function PromptOptions.withChoices is not accessible from the prompt module
Function PromptOptions.withChoices is not accessible from the prompt module
Function PromptOptions.withChoices is not accessible from the prompt module

withMsg() 🔗

Return Type
Options !
Arguments
NameTypeDefault ValueDescription
msgString !-No description provided
Example
Function PromptOptions.withMsg is not accessible from the prompt module
Function PromptOptions.withMsg is not accessible from the prompt module
Function PromptOptions.withMsg is not accessible from the prompt module
Function PromptOptions.withMsg is not accessible from the prompt module

withInput() 🔗

Return Type
Options !
Arguments
NameTypeDefault ValueDescription
inputString !-No description provided
Example
Function PromptOptions.withInput is not accessible from the prompt module
Function PromptOptions.withInput is not accessible from the prompt module
Function PromptOptions.withInput is not accessible from the prompt module
Function PromptOptions.withInput is not accessible from the prompt module

withMatch() 🔗

Return Type
Options !
Arguments
NameTypeDefault ValueDescription
matchString !-No description provided
Example
Function PromptOptions.withMatch is not accessible from the prompt module
Function PromptOptions.withMatch is not accessible from the prompt module
Function PromptOptions.withMatch is not accessible from the prompt module
Function PromptOptions.withMatch is not accessible from the prompt module

withCi() 🔗

Return Type
Options !
Arguments
NameTypeDefault ValueDescription
ciBoolean !-No description provided
Example
Function PromptOptions.withCi is not accessible from the prompt module
Function PromptOptions.withCi is not accessible from the prompt module
Function PromptOptions.withCi is not accessible from the prompt module
Function PromptOptions.withCi is not accessible from the prompt module

Result 🔗

outcome() 🔗

Return Type
Boolean !
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
 execute \
 outcome
func (m *MyModule) Example(ctx context.Context) bool  {
	return dag.
			Prompt().
			Execute().
			Outcome(ctx)
}
@function
async def example() -> bool:
	return await (
		dag.prompt()
		.execute()
		.outcome()
	)
@func()
async example(): Promise<boolean> {
	return dag
		.prompt()
		.execute()
		.outcome()
}

input() 🔗

Return Type
String !
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
 execute \
 input
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Prompt().
			Execute().
			Input(ctx)
}
@function
async def example() -> str:
	return await (
		dag.prompt()
		.execute()
		.input()
	)
@func()
async example(): Promise<string> {
	return dag
		.prompt()
		.execute()
		.input()
}

Prompt 🔗

options() 🔗

Return Type
Options !
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
 options
func (m *MyModule) Example() *dagger.PromptOptions  {
	return dag.
			Prompt().
			Options()
}
@function
def example() -> dagger.PromptOptions:
	return (
		dag.prompt()
		.options()
	)
@func()
example(): PromptOptions {
	return dag
		.prompt()
		.options()
}

withCi() 🔗

Return Type
Prompt !
Arguments
NameTypeDefault ValueDescription
ciBoolean !-No description provided
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
 with-ci --ci boolean
func (m *MyModule) Example(ci bool) *dagger.Prompt  {
	return dag.
			Prompt().
			WithCi(ci)
}
@function
def example(ci: bool) -> dagger.Prompt:
	return (
		dag.prompt()
		.with_ci(ci)
	)
@func()
example(ci: boolean): Prompt {
	return dag
		.prompt()
		.withCi(ci)
}

withMsg() 🔗

Return Type
Prompt !
Arguments
NameTypeDefault ValueDescription
msgString !-No description provided
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
 with-msg --msg string
func (m *MyModule) Example(msg string) *dagger.Prompt  {
	return dag.
			Prompt().
			WithMsg(msg)
}
@function
def example(msg: str) -> dagger.Prompt:
	return (
		dag.prompt()
		.with_msg(msg)
	)
@func()
example(msg: string): Prompt {
	return dag
		.prompt()
		.withMsg(msg)
}

withInput() 🔗

Return Type
Prompt !
Arguments
NameTypeDefault ValueDescription
inputString !-No description provided
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
 with-input --input string
func (m *MyModule) Example(input string) *dagger.Prompt  {
	return dag.
			Prompt().
			WithInput(input)
}
@function
def example(input: str) -> dagger.Prompt:
	return (
		dag.prompt()
		.with_input(input)
	)
@func()
example(input: string): Prompt {
	return dag
		.prompt()
		.withInput(input)
}

withMatch() 🔗

Return Type
Prompt !
Arguments
NameTypeDefault ValueDescription
matchString !-No description provided
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
 with-match --match string
func (m *MyModule) Example(match string) *dagger.Prompt  {
	return dag.
			Prompt().
			WithMatch(match)
}
@function
def example(match: str) -> dagger.Prompt:
	return (
		dag.prompt()
		.with_match(match)
	)
@func()
example(match: string): Prompt {
	return dag
		.prompt()
		.withMatch(match)
}

withChoices() 🔗

Return Type
Prompt !
Arguments
NameTypeDefault ValueDescription
choices[String ! ] !-No description provided
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
 with-choices --choices string1 --choices string2
func (m *MyModule) Example(choices []string) *dagger.Prompt  {
	return dag.
			Prompt().
			WithChoices(choices)
}
@function
def example(choices: List[str]) -> dagger.Prompt:
	return (
		dag.prompt()
		.with_choices(choices)
	)
@func()
example(choices: string[]): Prompt {
	return dag
		.prompt()
		.withChoices(choices)
}

execute() 🔗

Return Type
Result !
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
 execute
func (m *MyModule) Example() *dagger.PromptResult  {
	return dag.
			Prompt().
			Execute()
}
@function
def example() -> dagger.PromptResult:
	return (
		dag.prompt()
		.execute()
	)
@func()
example(): PromptResult {
	return dag
		.prompt()
		.execute()
}