terminal-prompt
Uses the dagger Terminal to prompt the user for input.
Installation
dagger install github.com/pjmagee/daggerverse/terminal-prompt@daa6feeb6e7b599b6ac5ae202e989fd296212c95
Entrypoint
Return Type
TerminalPrompt !
Example
dagger -m github.com/pjmagee/daggerverse/terminal-prompt@daa6feeb6e7b599b6ac5ae202e989fd296212c95 call \
func (m *myModule) example() *TerminalPrompt {
return dag.
TerminalPrompt()
}
@function
def example() -> dag.TerminalPrompt:
return (
dag.terminal_prompt()
)
@func()
example(): TerminalPrompt {
return dag
.terminalPrompt()
}
Types
TerminalPromptOptions 🔗
TerminalPromptResult 🔗
outcome() 🔗
Return Type
Boolean !
Example
dagger -m github.com/pjmagee/daggerverse/terminal-prompt@daa6feeb6e7b599b6ac5ae202e989fd296212c95 call \
execute \
outcome
func (m *myModule) example(ctx context.Context) bool {
return dag.
TerminalPrompt().
Execute().
Outcome(ctx)
}
@function
async def example() -> bool:
return await (
dag.terminal_prompt()
.execute()
.outcome()
)
@func()
async example(): Promise<boolean> {
return dag
.terminalPrompt()
.execute()
.outcome()
}
input() 🔗
Return Type
String !
Example
dagger -m github.com/pjmagee/daggerverse/terminal-prompt@daa6feeb6e7b599b6ac5ae202e989fd296212c95 call \
execute \
input
func (m *myModule) example(ctx context.Context) string {
return dag.
TerminalPrompt().
Execute().
Input(ctx)
}
@function
async def example() -> str:
return await (
dag.terminal_prompt()
.execute()
.input()
)
@func()
async example(): Promise<string> {
return dag
.terminalPrompt()
.execute()
.input()
}
TerminalPrompt 🔗
execute() 🔗
Executes the prompt and returns the result.
Return Type
TerminalPromptResult !
Example
dagger -m github.com/pjmagee/daggerverse/terminal-prompt@daa6feeb6e7b599b6ac5ae202e989fd296212c95 call \
execute
func (m *myModule) example() *TerminalPromptResult {
return dag.
TerminalPrompt().
Execute()
}
@function
def example() -> dag.TerminalPromptResult:
return (
dag.terminal_prompt()
.execute()
)
@func()
example(): TerminalPromptResult {
return dag
.terminalPrompt()
.execute()
}
withChoices() 🔗
Sets the list of choices the user can select from.
Return Type
TerminalPrompt !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
choices | [String ! ] ! | - | No description provided |
Example
dagger -m github.com/pjmagee/daggerverse/terminal-prompt@daa6feeb6e7b599b6ac5ae202e989fd296212c95 call \
with-choices --choices string1 --choices string2
func (m *myModule) example(choices []string) *TerminalPrompt {
return dag.
TerminalPrompt().
WithChoices(choices)
}
@function
def example(choices: List[str]) -> dag.TerminalPrompt:
return (
dag.terminal_prompt()
.with_choices(choices)
)
@func()
example(choices: string[]): TerminalPrompt {
return dag
.terminalPrompt()
.withChoices(choices)
}
withCi() 🔗
Sets the ci flag. If true, the prompt will not wait for user input.
Return Type
TerminalPrompt !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
ci | Boolean ! | - | No description provided |
Example
dagger -m github.com/pjmagee/daggerverse/terminal-prompt@daa6feeb6e7b599b6ac5ae202e989fd296212c95 call \
with-ci --ci boolean
func (m *myModule) example(ci bool) *TerminalPrompt {
return dag.
TerminalPrompt().
WithCi(ci)
}
@function
def example(ci: bool) -> dag.TerminalPrompt:
return (
dag.terminal_prompt()
.with_ci(ci)
)
@func()
example(ci: boolean): TerminalPrompt {
return dag
.terminalPrompt()
.withCi(ci)
}
withInput() 🔗
Sets the input to return if the ci flag is set to true.
Return Type
TerminalPrompt !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
input | String ! | - | No description provided |
Example
dagger -m github.com/pjmagee/daggerverse/terminal-prompt@daa6feeb6e7b599b6ac5ae202e989fd296212c95 call \
with-input --input string
func (m *myModule) example(input string) *TerminalPrompt {
return dag.
TerminalPrompt().
WithInput(input)
}
@function
def example(input: str) -> dag.TerminalPrompt:
return (
dag.terminal_prompt()
.with_input(input)
)
@func()
example(input: string): TerminalPrompt {
return dag
.terminalPrompt()
.withInput(input)
}
withMatch() 🔗
Sets the regex pattern that the user input must match.
Return Type
TerminalPrompt !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
match | String ! | - | No description provided |
Example
dagger -m github.com/pjmagee/daggerverse/terminal-prompt@daa6feeb6e7b599b6ac5ae202e989fd296212c95 call \
with-match --match string
func (m *myModule) example(match string) *TerminalPrompt {
return dag.
TerminalPrompt().
WithMatch(match)
}
@function
def example(match: str) -> dag.TerminalPrompt:
return (
dag.terminal_prompt()
.with_match(match)
)
@func()
example(match: string): TerminalPrompt {
return dag
.terminalPrompt()
.withMatch(match)
}
withMsg() 🔗
Sets the message to display to the user.
Return Type
TerminalPrompt !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
msg | String ! | - | No description provided |
Example
dagger -m github.com/pjmagee/daggerverse/terminal-prompt@daa6feeb6e7b599b6ac5ae202e989fd296212c95 call \
with-msg --msg string
func (m *myModule) example(msg string) *TerminalPrompt {
return dag.
TerminalPrompt().
WithMsg(msg)
}
@function
def example(msg: str) -> dag.TerminalPrompt:
return (
dag.terminal_prompt()
.with_msg(msg)
)
@func()
example(msg: string): TerminalPrompt {
return dag
.terminalPrompt()
.withMsg(msg)
}
withOptions() 🔗
Sets the options for the prompt.
Return Type
TerminalPrompt !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
ci | Boolean ! | true | No description provided |
msg | String ! | "Continue? (y/n)" | No description provided |
input | String ! | "" | No description provided |
match | String ! | "y" | No description provided |
choices | [String ! ] ! | [] | No description provided |
Example
dagger -m github.com/pjmagee/daggerverse/terminal-prompt@daa6feeb6e7b599b6ac5ae202e989fd296212c95 call \
with-options --ci boolean --msg string --input string --match string --choices string1 --choices string2
func (m *myModule) example(ci bool, msg string, input string, match string, choices []string) *TerminalPrompt {
return dag.
TerminalPrompt().
WithOptions(ci, msg, input, match, choices)
}
@function
def example(ci: bool, msg: str, input: str, match: str, choices: List[str]) -> dag.TerminalPrompt:
return (
dag.terminal_prompt()
.with_options(ci, msg, input, match, choices)
)
@func()
example(ci: boolean, msg: string, input: string, match: string, choices: string[]): TerminalPrompt {
return dag
.terminalPrompt()
.withOptions(ci, msg, input, match, choices)
}