Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make as many examples in the CLI docs as possible copy-and-pastable #551

Closed
simonw opened this issue May 21, 2023 · 6 comments
Closed

Make as many examples in the CLI docs as possible copy-and-pastable #551

simonw opened this issue May 21, 2023 · 6 comments

Comments

@simonw
Copy link
Owner

simonw commented May 21, 2023

e.g. in this section:

https://sqlite-utils.datasette.io/en/stable/cli.html#running-queries-directly-against-csv-or-json

image

The little copy button will also copy the $ which breaks the examples when copied.

@simonw
Copy link
Owner Author

simonw commented May 21, 2023

I wrote the docs like this because early examples include both the command and its output:

https://sqlite-utils.datasette.io/en/stable/cli.html#returning-json

image

@simonw
Copy link
Owner Author

simonw commented May 21, 2023

I could split them up into two blocks like this:

image

I do miss the visual indication that one of these is the command and one is the output though.

@simonw
Copy link
Owner Author

simonw commented May 21, 2023

Another option:

image

That's using this markup:

Newline-delimited JSON
~~~~~~~~~~~~~~~~~~~~~~

Use ``--nl`` to get back newline-delimited JSON objects:

.. code-block:: bash

    sqlite-utils dogs.db "select * from dogs" --nl

.. code-block:: output

    {"id": 1, "age": 4, "name": "Cleo"}
    {"id": 2, "age": 2, "name": "Pancakes"}

And this extra CSS:

.highlight-output .highlight {
  border-left: 9px solid #30c94f;
}

@simonw
Copy link
Owner Author

simonw commented May 21, 2023

Put this in a PR so I can preview it:

@simonw
Copy link
Owner Author

simonw commented May 21, 2023

@simonw
Copy link
Owner Author

simonw commented May 21, 2023

simonw added a commit that referenced this issue May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant