cli

CLI entry points for the afwf-fts-anything Alfred workflow.

This module is the wiring layer only: it hard-codes the project-home paths from paths and delegates all logic to fts, data_catalog, and Dataset. Command exposes the subcommands via fire.Fire.

afwf_fts_anything.cli.fts(dataset_name: str, query: str, action: ActionEnum = ActionEnum.open_url) ScriptFilter[source]

Thin wrapper around fts_mod.fts() that supplies the project-home paths and wraps the result in a afwf.ScriptFilter.

Query normalisation (bool → empty string) is handled by Command.fts() before this is called.

afwf_fts_anything.cli.list_datasets_for_reset(dataset_name_query: str) ScriptFilter[source]

Enumerate all valid datasets in the project home and optionally fuzzy-filter them. Each item’s action triggers rebuild-index for that dataset.

Uses DataCatalog to discover datasets; invalid (unparseable) setting files are skipped. Falls back to the full list when fuzzy matching yields no results.

afwf_fts_anything.cli.setup_sample_data() None[source]

Copy the bundled movie sample dataset into the project home so the workflow works out of the box after a single uvx call.

Source : afwf_fts_anything/tests/data/movie/ (shipped with the package) Dest : ~/.alfred-afwf/afwf_fts_anything/movie/

All existing files in the destination are overwritten.

afwf_fts_anything.cli.rebuild_index(dataset_name: str) None[source]

Destroy and recreate the tantivy index for dataset_name.

Uses DataCatalog to locate the dataset under the project home, removes the existing index directory, optionally re-downloads the source data, then rebuilds the index.

class afwf_fts_anything.cli.Command[source]

Alfred workflow subcommands exposed via fire.Fire.

fts(dataset_name: str, query: str = '*', action: str = 'open_url')[source]

Full-text search; see fts().

Normalises Fire’s boolean True (blank Alfred field) to an empty string before delegating.

list_datasets_for_reset(dataset_name_query: str = '')[source]

List datasets with optional fuzzy filter; see list_datasets_for_reset().

Normalises Fire’s boolean True to an empty string before delegating.

rebuild_index(dataset_name: str)[source]

Rebuild the search index for a dataset; see rebuild_index().

setup_sample_data()[source]

Copy the bundled movie sample dataset to the workflow home; see setup_sample_data().