simonw / dclient

A client CLI utility for Datasette instances
Apache License 2.0
11 stars 0 forks source link

Also register as a Datasette plugin #4

Closed simonw closed 2 years ago

simonw commented 2 years ago

It would be neat if installing this added a datasette client command to Datasette: https://docs.datasette.io/en/stable/plugin_hooks.html#register-commands-cli

simonw commented 2 years ago

Well that worked!

datasette install https://github.com/simonw/dclient/archive/refs/heads/main.zip
% datasette --help
Usage: datasette [OPTIONS] COMMAND [ARGS]...

  Datasette is an open source multi-tool for exploring and publishing data

  About Datasette: https://datasette.io/
  Full documentation: https://docs.datasette.io/

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  serve*     Serve up specified SQLite database files with a web UI
  client     A client CLI utility for Datasette instances
  inspect    Generate JSON summary of provided database files
  install    Install plugins and packages from PyPI into the same...
  package    Package SQLite files into a Datasette Docker container
  plugins    List currently installed plugins
  publish    Publish specified SQLite database files to the internet...
  uninstall  Uninstall plugins and Python packages from the Datasette...
% datasette client alias list
content = https://datasette.io/content
fixtures = https://latest.datasette.io/fixtures
% datasette client query content 'select * from news limit 1'
[
  {
    "date": "2022-10-27",
    "body": "[Datasette 0.63](https://docs.datasette.io/en/stable/changelog.html#v0-63) is out. Here are the [annotated release notes](https://simonwillison.net/2022/Oct/27/datasette-0-63/)."
  }
]
simonw commented 2 years ago

Turned this into a TIL: https://til.simonwillison.net/datasette/cli-tool-that-is-also-a-plugin