Skip to content

Commit

Permalink
fix: group new options, sort adapter groups (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
tconbeer authored Jan 22, 2024
1 parent 42679c0 commit a7618de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Bug Fixes

- The new `--show-files` and `--show-s3` options are now correctly grouped under "Harlequin Options" in `harlequin --help`; installed adapters are now alphabetically sorted.

## [1.12.0] - 2024-01-22

### Features
Expand Down
14 changes: 8 additions & 6 deletions src/harlequin/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@
"name": "Harlequin Options",
"options": [
"--profile",
"--config-path",
"--adapter",
"--show-files",
"--show-s3",
"--theme",
"--limit",
"--config",
"--config-path",
"--no-download-tzdata",
"--version",
"--help",
Expand Down Expand Up @@ -191,16 +193,16 @@ def build_cli() -> click.Command:
"-f",
type=click.Path(exists=True, file_okay=False, dir_okay=True, path_type=Path),
help=(
"Pass the path to a directory to this option to show a file tree viewer "
"in Harlequin's Data Catalog."
"The path to a directory to show in a file tree viewer "
"in the Data Catalog."
),
)
@click.option(
"--show-s3",
"--s3",
help=(
"Pass a bucket name or URI, or the keyword `all` to show s3 objects "
"in the data catalog."
"The bucket name or URI, or the keyword `all` to show s3 objects "
"in the Data Catalog."
),
)
@click.option(
Expand Down Expand Up @@ -307,7 +309,7 @@ def inner_cli(
# we load the options into a dict keyed by their name to de-dupe options
# that may be passed by multiple adapters.
options: dict[str, Callable[[click.Command], click.Command]] = {}
for adapter_name, adapter_cls in adapters.items():
for adapter_name, adapter_cls in sorted(adapters.items()):
option_name_list: list[str] = []
if adapter_cls.ADAPTER_OPTIONS is not None:
for option in adapter_cls.ADAPTER_OPTIONS:
Expand Down

0 comments on commit a7618de

Please sign in to comment.