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 languageno available example in current languageExample (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 languageno available example in current languageInstallation
dagger install github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537fEntrypoint
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 moduleFunction PromptOptions.ci is not accessible from the prompt moduleFunction PromptOptions.ci is not accessible from the prompt moduleFunction PromptOptions.ci is not accessible from the prompt modulemsg() 🔗
Return Type
String ! Example
Function PromptOptions.msg is not accessible from the prompt moduleFunction PromptOptions.msg is not accessible from the prompt moduleFunction PromptOptions.msg is not accessible from the prompt moduleFunction PromptOptions.msg is not accessible from the prompt moduleinput() 🔗
Return Type
String ! Example
Function PromptOptions.input is not accessible from the prompt moduleFunction PromptOptions.input is not accessible from the prompt moduleFunction PromptOptions.input is not accessible from the prompt moduleFunction PromptOptions.input is not accessible from the prompt modulematch() 🔗
Return Type
String ! Example
Function PromptOptions.match is not accessible from the prompt moduleFunction PromptOptions.match is not accessible from the prompt moduleFunction PromptOptions.match is not accessible from the prompt moduleFunction PromptOptions.match is not accessible from the prompt modulechoices() 🔗
Return Type
[String ! ] ! Example
Function PromptOptions.choices is not accessible from the prompt moduleFunction PromptOptions.choices is not accessible from the prompt moduleFunction PromptOptions.choices is not accessible from the prompt moduleFunction PromptOptions.choices is not accessible from the prompt modulewithChoices() 🔗
Return Type
Options !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| choices | [String ! ] ! | - | No description provided |
Example
Function PromptOptions.withChoices is not accessible from the prompt moduleFunction PromptOptions.withChoices is not accessible from the prompt moduleFunction PromptOptions.withChoices is not accessible from the prompt moduleFunction PromptOptions.withChoices is not accessible from the prompt modulewithMsg() 🔗
Return Type
Options !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| msg | String ! | - | No description provided |
Example
Function PromptOptions.withMsg is not accessible from the prompt moduleFunction PromptOptions.withMsg is not accessible from the prompt moduleFunction PromptOptions.withMsg is not accessible from the prompt moduleFunction PromptOptions.withMsg is not accessible from the prompt modulewithInput() 🔗
Return Type
Options !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| input | String ! | - | No description provided |
Example
Function PromptOptions.withInput is not accessible from the prompt moduleFunction PromptOptions.withInput is not accessible from the prompt moduleFunction PromptOptions.withInput is not accessible from the prompt moduleFunction PromptOptions.withInput is not accessible from the prompt modulewithMatch() 🔗
Return Type
Options !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| match | String ! | - | No description provided |
Example
Function PromptOptions.withMatch is not accessible from the prompt moduleFunction PromptOptions.withMatch is not accessible from the prompt moduleFunction PromptOptions.withMatch is not accessible from the prompt moduleFunction PromptOptions.withMatch is not accessible from the prompt modulewithCi() 🔗
Return Type
Options !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ci | Boolean ! | - | No description provided |
Example
Function PromptOptions.withCi is not accessible from the prompt moduleFunction PromptOptions.withCi is not accessible from the prompt moduleFunction PromptOptions.withCi is not accessible from the prompt moduleFunction PromptOptions.withCi is not accessible from the prompt moduleResult 🔗
outcome() 🔗
Return Type
Boolean ! Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
execute \
outcomefunc (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 \
inputfunc (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 \
optionsfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| ci | Boolean ! | - | No description provided |
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
with-ci --ci booleanfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| msg | String ! | - | No description provided |
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
with-msg --msg stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| input | String ! | - | No description provided |
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
with-input --input stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| match | String ! | - | No description provided |
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
with-match --match stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| choices | [String ! ] ! | - | No description provided |
Example
dagger -m github.com/pjmagee/dagger-prompt@6deb6b3cab9477c5bd2df8b2dc6a2f871d33537f call \
with-choices --choices string1 --choices string2func (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 \
executefunc (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()
}