hobnob
Tasks return values, prompts are steps and JSON stays data. It reads like a book, and runs like one.
curl -fsSL https://github.com/jakesmd/hobnob/releases/latest/download/install.sh | bashOne static binary. On CI, add it to GitHub Actions.
Query an API from any step, then use the response for the rest of the run.
A text box, a menu or a multi-select, built from an earlier step's output.
Dot into it ten steps later, at any depth. No parsing step.
Bare hobnob opens a menu of tasks, and whatever a task needs, it prompts for.
tasks:
ask-trivia:
info: Answer a trivia question from a category you pick.
steps:
# Query an API. The response is a value now.
- run: curl -fsS https://the-trivia-api.com/v2/categories
into:
- CATEGORIES: stdout
# The menu is built from what that step returned.
- get:
- CATEGORY:
info: Which category?
options: .CATEGORIES | keys
# Look up the chosen category's id by name.
- run: curl -fsS "https://the-trivia-api.com/v2/questions?limit=1&categories={{ .CATEGORIES[.CATEGORY][0] }}"
into:
- TRIVIA: stdout[0]
# Shuffle the answers, so the right one isn't always first.
- run: [sh, -c, 'printf "%s\n" "$@" | sort -R', answers, .TRIVIA.correctAnswer, .TRIVIA.incorrectAnswers]
into:
- ANSWERS: stdout | lines
# Dot straight into the JSON. No parsing step.
- get:
- GUESS:
info: "{{ .TRIVIA.question.text }}"
options: .ANSWERS
- run: echo "Correct!"
if: "{{ eq .GUESS (.TRIVIA.correctAnswer | trim) }}"
- run: 'echo "Not quite. It was {{ .TRIVIA.correctAnswer | trim }}."'
if: "{{ ne .GUESS (.TRIVIA.correctAnswer | trim) }}"Live, in your browser: the questions come straight from the API.