GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python-ticket/plugins/ticket-open at master · sjaandi-project/python-ticket Expand file tree/ Copy pathticket-openMore file actions executable file ·39 lines (35 loc) · 1001 Bytes / Copy pathticket-openFile metadata and controlsexecutable file ·39 lines (35 loc) · 1001 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 #!/usr/bin/env bash # tk-plugin: Open ticket in $EDITOR # tk-plugin-version: 1.0.0 set -euo pipefail if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then echo "Usage: tk open <id>" exit 0 fi if [[ $# -lt 1 ]]; then echo "Usage: tk open <id>" >&2 exit 1 fi id="$1" read -r id <<< "$id" # Resolve ticket file (exact or partial match) file="$TICKETS_DIR/${id}.md" if [[ ! -f "$file" ]]; then matches=$(find "$TICKETS_DIR" -maxdepth 1 -name "*${id}*.md" 2>/dev/null) # grep -c prints 0 and exits 1 when nothing matches; only that case passes. count=$(printf '%s\n' "$matches" | grep -c .) || [[ $? -eq 1 ]] if [[ "$count" -eq 1 ]]; then file="$matches" elif [[ "$count" -gt 1 ]]; then echo "Error: ambiguous ID '$id' matches multiple tickets" >&2 exit 1 else echo "Error: ticket '$id' not found" >&2 exit 1 fi fi if [ -t 0 ] && [ -t 1 ]; then "${EDITOR:-vi}" "$file" else echo "Edit ticket file: $file" fi |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |