Skip to main content
Version: 0.3.0

Table and Spin

Data display and loading indicator components.

Table

Display and optionally select from tabular data.

Basic Usage

# From a CSV file
invowk tui table --file data.csv

# From stdin with separator
echo -e "name|age|city
Alice|30|NYC
Bob|25|LA" | invowk tui table --separator "|"

Options

OptionDescription
--fileCSV file to display
--separatorColumn separator (default: ,)
--columnsColumn headers (override file header)
--widthsColumn widths (comma-separated integers)
--selectableAllow row selection
--heightTable height

Examples

# Display CSV
invowk tui table --file users.csv

# Custom separator (TSV)
invowk tui table --file data.tsv --separator $' '

# Pipe-separated
cat data.txt | invowk tui table --separator "|"

Selectable Tables

# Select a row
SELECTED=$(invowk tui table --file servers.csv --selectable)
echo "Selected: $SELECTED"

The selected row is returned as the full CSV line.

Real-World Examples

Display Server List

# servers.csv:
# name,ip,status
# web-1,10.0.0.1,running
# web-2,10.0.0.2,running
# db-1,10.0.0.3,stopped

invowk tui table --file servers.csv

Select and SSH

# Select a server
SERVER=$(cat servers.csv | invowk tui table --selectable | cut -d',' -f2)
ssh "user@$SERVER"

Process List

ps aux --no-headers | awk '{print $1","$2","$11}' | 
(echo "USER,PID,COMMAND"; cat) |
invowk tui table --selectable

Spin

Show a spinner while running a long command.

Basic Usage

invowk tui spin --title "Installing..." -- npm install

Options

OptionDescription
--titleSpinner title/message
--typeSpinner animation type

Spinner Types

Available spinner animations:

  • line - Simple line
  • dot - Dots
  • minidot - Small dots
  • jump - Jumping dots
  • pulse - Pulsing dot
  • points - Points
  • globe - Spinning globe
  • moon - Moon phases
  • monkey - Monkey
  • meter - Progress meter
  • hamburger - Hamburger menu
  • ellipsis - Ellipsis
invowk tui spin --type globe --title "Downloading..." -- curl -O https://example.com/file
invowk tui spin --type moon --title "Building..." -- make build
invowk tui spin --type pulse --title "Testing..." -- npm test

Examples

# Basic spinner
invowk tui spin --title "Building..." -- go build ./...

# With specific type
invowk tui spin --type dot --title "Installing dependencies..." -- npm install

# Long-running task
invowk tui spin --title "Compiling assets..." -- webpack --mode production

Chained Spinners

echo "Step 1/3: Dependencies"
invowk tui spin --title "Installing..." -- npm install

echo "Step 2/3: Build"
invowk tui spin --title "Building..." -- npm run build

echo "Step 3/3: Tests"
invowk tui spin --title "Testing..." -- npm test

echo "Done!" | invowk tui style --foreground "#00FF00" --bold

Exit Code Handling

The spin command returns the exit code of the wrapped command:

if invowk tui spin --title "Testing..." -- npm test; then
echo "Tests passed!"
else
echo "Tests failed!"
exit 1
fi

In Scripts

{
name: "deploy"
description: "Deploy with progress indication"
implementations: [{
script: """
echo "Deploying application..."

invowk tui spin --title "Building Docker image..." --
docker build -t myapp .

invowk tui spin --title "Pushing to registry..." --
docker push myapp

invowk tui spin --title "Updating Kubernetes..." --
kubectl rollout restart deployment/myapp

invowk tui spin --title "Waiting for rollout..." --
kubectl rollout status deployment/myapp

echo "Deployment complete!" | invowk tui style --foreground "#00FF00" --bold
"""
runtimes: [{name: "native"}]
platforms: [{name: "linux"}, {name: "macos"}]
}]
}

Combined Patterns

Select Then Execute with Spinner

# Choose what to build
PROJECT=$(invowk tui choose --title "Build which project?" api web worker)

# Build with spinner
invowk tui spin --title "Building $PROJECT..." -- make "build-$PROJECT"

Table Selection with Spinner Action

# Select server
SERVER=$(invowk tui table --file servers.csv --selectable | cut -d',' -f1)

# Restart with spinner
invowk tui spin --title "Restarting $SERVER..." -- ssh "$SERVER" "systemctl restart myapp"

Next Steps