()
| 19 | ` |
| 20 | |
| 21 | func Run() { |
| 22 | if len(os.Args) < 2 { |
| 23 | fmt.Print(helpMessage) |
| 24 | return |
| 25 | } |
| 26 | switch command := os.Args[1]; command { |
| 27 | case "add": |
| 28 | Add() |
| 29 | case "tidy": |
| 30 | Tidy() |
| 31 | case "version": |
| 32 | fmt.Println("esm.sh CLI " + VERSION) |
| 33 | default: |
| 34 | for _, arg := range os.Args[1:] { |
| 35 | if arg == "--version" { |
| 36 | fmt.Println("esm.sh CLI " + VERSION) |
| 37 | return |
| 38 | } |
| 39 | if arg == "-v" { |
| 40 | fmt.Println(VERSION) |
| 41 | return |
| 42 | } |
| 43 | } |
| 44 | fmt.Print(helpMessage) |
| 45 | } |
| 46 | } |