Textualize/trogon

Doesn't support multiple positional arguments - nargs=-1

simonw opened this issue · 1 comments

As far as I can tell Trogon supports this:

@click.option(
    "-c",
    "--column",
    type=str,
    multiple=True,
    help="Column definitions for the table",
)

This creates an input field with a "+ value" button for adding multiple rows.

But it doesn't support this:

@click.argument(
    "file_or_dir",
    nargs=-1,
    required=True,
    type=click.Path(file_okay=True, dir_okay=True, allow_dash=True),
)

Where nargs=-1 indicates a positional argument can be provided multiple times.

These examples are for sqlite-utils insert-files - which looks like this in Trogon:

CleanShot 2023-05-21 at 08 40 24@2x

file_or_dir there should have a + value button in the same way that -c / --column does.

This is the --help for that command:

Usage: sqlite-utils insert-files [OPTIONS] PATH TABLE FILE_OR_DIR...

  Insert one or more files using BLOB columns in the specified table

  Example:

      sqlite-utils insert-files pics.db images *.gif \
          -c name:name \
          -c content:content \
          -c content_hash:sha256 \
          -c created:ctime_iso \
          -c modified:mtime_iso \
          -c size:size \
          --pk name

Note how FILE_OR_DIR... in the summary has that ... indicating this can be passed multiple times.

Can confirm this works correctly in sqlite-utils with the latest trogon:

sqlite-utils analyze-tables content.db repos users

Produced by:

image