Shef, a wordplay on "shell" and "chef", is a powerful CLI tool for cooking up advanced shell recipes.
Essentially, imagine that Make, GitHub Actions,
and CyberChef had a weird little <moira-rose>bea-by</>
.
Shef allows you to pipe shell commands together, add interactive user prompts, loop using complex control structures, easily run and manage background tasks, and build reusable workflows with advanced logic and conditions.
The following example showcases a simple Shef recipe, giving you a quick glance at the syntax and functionality.
recipes:
- name: "conditional"
description: "A simple demo of conditional operations using direct prompt values"
category: "demo"
operations:
- name: "Choose Fruit"
id: "choose"
command: 'echo "You selected: {{ .fruit }}"'
prompts:
- name: "Fruit Select"
id: "fruit"
type: "select"
message: "Choose a fruit:"
options:
- "Apples"
- "Oranges"
- name: "Apple Operation"
id: "apple"
command: echo "This is the apple operation! 🍎"
condition: .fruit == "Apples"
- name: "Orange Operation"
id: "orange"
command: echo "This is the orange operation! 🍊"
condition: .fruit == "Oranges"
Tip
Want to see more before diving deeper? Check out the demo recipes.
- Installation
- A Note on Bash and YAML
- Command Reference
- Recipe Sources
- Recipe Structure
- Operation Execution Order
- Interactive Prompts
- Control Flow Structures
- Transformations
- Conditional Execution
- Data Flow Between Operations
- Branching Workflows
- Arguments and Flags
- Recipe Help Documentation
- Creating Recipes
- Example Recipes
- AI-Assisted Recipe Creation
- Troubleshooting
- Contributing to Shef
- Additional Reference
- Command Piping: Chain multiple commands together, passing output from one command to the next
- Transformations: Transform command output with powerful templating
- Interactive Prompts: Add user input, selections, confirmations, and more
- Conditional Logic: Branching based on command results
- Control Flow: Create dynamic workflows with loops and control structures
- Background Task Management: Easily monitor and control background tasks
- Progress Mode: Inline updates for clean status updates and progress indicators
- Multiple Sources and Contexts: Use local, user, or public recipes
- Public Recipes: Common, useful recipes anyone can use. Browse public recipes.
Once Shef is installed, you are ready to begin using it.
# Sync all public recipes locally
shef sync
# Run the Hello World recipe
shef demo hello-world
# View help information about a recipe
shef demo hello-world --help
# List available recipes (demo recipes are excluded by default)
shef ls
# List all recipes within a specific category
shef ls demo
Ready to learn more? Start with learning how to build your own recipes, then check out recipe arguments and flags and background task management.