noora-text-prompt
Noora Text Prompt
Use this skill when a Swift CLI needs one typed answer from the user.
Basic Pattern
import Noora
let name = Noora().textPrompt(
title: "Project name",
prompt: "How would you like to name your project?",
description: "This name will be used for generated files.",
defaultValue: "demo-app",
collapseOnAnswer: true,
validationRules: [
NonEmptyValidationRule(error: "Project name cannot be empty.")
]
)
When To Use
- Naming a project, target, or environment.
- Asking for a token, host, path, or identifier.
- Gathering one value before scaffolding or deployment.
Guidance
- Always add validation when empty or malformed input would break the next step.
- Use
defaultValuewhen there is a sensible generated fallback. - Keep the prompt specific. The
descriptionshould explain impact, not restate the prompt. - Expect a non-interactive session to be a problem for prompts; these APIs are for TTY use.
Avoid
- Using a text prompt for a closed set of known choices. Prefer a choice prompt.
- Accepting unchecked user input when a bad value would cascade into file or network failures.
More from spqw/skills-noora
noora-alerts
Use when building Noora warning, success, error, or info alerts in a Swift CLI. Covers choosing alert type, structuring takeaways, and using `TerminalText` interpolation inside alert copy.
1noora-progress-step
Use when a Swift CLI needs a spinner-style Noora progress step for an async operation. Covers `progressStep`, optional status updates, success and error messages, and sequencing multiple steps.
1noora-text-formatting
Use when composing or formatting Noora `TerminalText` in a Swift CLI. Covers semantic text components such as commands, links, paths, and themed text, plus `Noora().format(...)`.
1noora-collapsible-step
Use when a Swift CLI needs Noora to stream multiple log lines during a task and collapse them on success or failure. Covers `collapsibleStep`, `visibleLines`, and writing readable progress lines.
1noora-interactive-tables
Use when building interactive Noora tables in a Swift CLI. Covers selectable tables, paginated tables, lazy paginated loading, updating tables from async sequences, and TTY constraints.
1noora-progress-bar-step
Use when a Swift CLI needs percentage-based progress with Noora. Covers `progressBarStep`, reporting values from 0 to 1, and choosing bar updates for downloads, migrations, and batch work.
1