johndpjr / AgTern

20 stars 5 forks source link

Improve AgTern CLI #203

Open JeremyEastham opened 7 months ago

JeremyEastham commented 7 months ago

Our CLI is a bit of a mess right now. There are many flags that all do different things, some of which have conflicting behavior. It is not clear which flags you should use when, or even what all of the flags are.

╭─ Before ─────────────────────────────────────────────┬─ After ─────────────────────────────╮
│  npm run start                                       │  agtern run frontend                │
│  npm run update-api-client                           │  agtern sync api                    │
│  python -m backend                                   │  agtern run backend --production    │
│  python -m backend --dev                             │  agtern run backend                 │
│  python -m backend --dev --no-scrape                 │  agtern run api                     │
│  python -m backend --dev --scrape-only               │  agtern run scraper                 │
│  python -m backend --dev --save-jobs                 │  agtern run backend                 │
│  python -m backend --dev --show-scraper --save-jobs  │  agtern run backend --show-scraper  │
╰──────────────────────────────────────────────────────┴─────────────────────────────────────╯
╭─ Other Options ──────────────────────────────────────┬─────────────────────────────────────╮
│  --(in/ex)clude-companies --run-as-proc              │  --timeout=5 --max-jobs=3           │
╰──────────────────────────────────────────────────────┴─────────────────────────────────────╯

Other possible features:

For the best developer experience, these commands should have useful error messages and help output. This can be achieved easily using the Typer library, a library written by the maintainer of FastAPI that is advertised as the FastAPI of CLIs. Typer also features automatic shell autocompletion of CLI parameters and pretty formatting.