ข้ามไปเนื้อหาหลัก

● กำลังพัฒนา

URL Shortener CLI

CLI tool ย่อ URL ด้วย TinyURL API และจัดการ history — บันทึก, ค้นหา และ copy ไปยัง clipboard

· อ่านประมาณ 1 นาที

สารบัญ

ภาพรวม

ย่อ URL บ่อยสำหรับแชร์ link ยาวจาก e-commerce หรือ product catalog ใน LINE/chat tool นี้ย่อได้เลยจาก terminal พร้อม copy ไป clipboard อัตโนมัติและบันทึก history ไว้ค้นหาทีหลัง

สิ่งที่ทำแล้ว

  • Shortenshorten <url> ส่ง URL ไปยัง TinyURL API แล้ว print short URL
  • Auto-copy — copy ผลลัพธ์ไป clipboard อัตโนมัติด้วย clipboardy
  • History — บันทึก URL pairs ลงใน ~/.url-history.json พร้อม timestamp
  • Listshorten list แสดง history 10 รายการล่าสุดใน table format
  • Searchshorten search <keyword> ค้นหาจาก history ด้วย keyword
  • Openshorten open <short-url> เปิด URL ใน browser โดยตรง

ตัวอย่าง

$ shorten https://panupongws.com/resources/drizzle-orm-guide
 https://tinyurl.com/2abc123x (copied to clipboard)

$ shorten list
┌─────────────────────────────────────────┬──────────────────────────────────┬──────────────────┐
 Original Short URL Date
├─────────────────────────────────────────┼──────────────────────────────────┼──────────────────┤
 https://panupongws.com/resources/... https://tinyurl.com/2abc123x 2026-06-15 12:30
└─────────────────────────────────────────┴──────────────────────────────────┴──────────────────┘

กำลังทำ

  • Custom alias — shorten <url> --alias my-link สร้าง short URL แบบกำหนด slug เอง
  • Provider เพิ่มเติม — Rebrandly, is.gd เพื่อ fallback ถ้า TinyURL ล่ม
  • QR code mode — --qr generate QR code ใน terminal ด้วย ASCII art

เทคโนโลยี

  • TypeScript + Node.js 22
  • commander สำหรับ CLI
  • clipboardy สำหรับ clipboard access
  • cli-table3 สำหรับ table output
  • TinyURL API (ไม่ต้อง API key สำหรับ basic usage)