From a4f7df767ad97951a70e771e455bdc5fb0004031 Mon Sep 17 00:00:00 2001 From: dzucconi Date: Thu, 12 Mar 2026 22:35:41 -0400 Subject: [PATCH] Adds missing search params --- README.md | 9 ++++++++- src/commands/search.tsx | 41 +++++++++++++++++++++++++++++++++++++-- src/lib/registry.tsx | 43 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 89 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 063474d..b9f76c3 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,13 @@ arena group followers are-na-team ```bash arena search "brutalist architecture" arena search "photography" --type Image +arena search "design" --scope my +arena search "*" --type Attachment --ext pdf +arena search "architecture" --sort created_at_desc +arena search "*" --user-id 12345 +arena search "*" --channel-id 789 +arena search "art" --after 2024-01-01T00:00:00Z +arena search "*" --sort random --seed 42 ``` ### Other @@ -135,7 +142,7 @@ arena ping # API health check | `upload` | `--channel`, `--title`, `--description` | | `connect` | `--type`, `--position` | | `connection move` | `--movement`, `--position` | -| `search` | `--scope`, `--ext`, `--after`, `--seed`, `--user-id`, `--group-id`, `--channel-id` | +| `search` | `--scope`, `--sort`, `--ext`, `--after`, `--seed`, `--user-id`, `--group-id`, `--channel-id` | | `import` | `--dir`, `--recursive`, `--interactive`, `--batch-size`, `--upload-concurrency`, `--poll-interval` | ## Aliases diff --git a/src/commands/search.tsx b/src/commands/search.tsx index deae972..10ad1a6 100644 --- a/src/commands/search.tsx +++ b/src/commands/search.tsx @@ -1,6 +1,14 @@ import { Box, Text } from "ink"; import { client, getData } from "../api/client"; -import type { Block, ChannelRef, SearchTypeFilter, User } from "../api/types"; +import type { + Block, + ChannelRef, + FileExtension, + SearchScope, + SearchSort, + SearchTypeFilter, + User, +} from "../api/types"; import { BlockItem } from "../components/BlockItem"; import { Spinner } from "../components/Spinner"; import { useCommand } from "../hooks/use-command"; @@ -11,9 +19,30 @@ interface Props { page?: number; per?: number; type?: string; + sort?: SearchSort; + scope?: SearchScope; + ext?: FileExtension; + after?: string; + seed?: number; + userId?: number; + groupId?: number; + channelId?: number; } -export function SearchCommand({ query, page = 1, per = 24, type }: Props) { +export function SearchCommand({ + query, + page = 1, + per = 24, + type, + sort, + scope, + ext, + after, + seed, + userId, + groupId, + channelId, +}: Props) { const { data, error, loading } = useCommand(() => getData( client.GET("/v3/search", { @@ -23,6 +52,14 @@ export function SearchCommand({ query, page = 1, per = 24, type }: Props) { page, per, type: type ? [type as SearchTypeFilter] : undefined, + sort, + scope, + ext: ext ? [ext] : undefined, + after, + seed, + user_id: userId, + group_id: groupId, + channel_id: channelId, }, }, }), diff --git a/src/lib/registry.tsx b/src/lib/registry.tsx index 5a9a1c2..7027690 100644 --- a/src/lib/registry.tsx +++ b/src/lib/registry.tsx @@ -374,7 +374,40 @@ export const commands: CommandDefinition[] = [ name: "search", aliases: ["s"], group: "Other", - help: [{ usage: "search ", description: "Search Are.na" }], + help: [ + { usage: "search ", description: "Search Are.na" }, + { + usage: "search --type Image", + description: + "Filter by type (Text, Image, Link, Attachment, Embed, Channel, Block, User, Group)", + }, + { + usage: "search --scope my", + description: "Limit scope (all, my, following)", + }, + { + usage: "search --sort created_at_desc", + description: + "Sort order (score_desc, created_at_desc, created_at_asc, updated_at_desc, updated_at_asc, name_asc, name_desc, connections_count_desc, random)", + }, + { + usage: "search --ext pdf", + description: "Filter by file extension", + }, + { + usage: "search --after 2024-01-01T00:00:00Z", + description: "Only results updated after timestamp (ISO 8601)", + }, + { + usage: "search --channel-id 789", + description: + "Limit to a channel (--user-id, --group-id also available)", + }, + { + usage: "search --sort random --seed 42", + description: "Reproducible random ordering", + }, + ], session: { args: "", desc: "Search Are.na" }, render(args, flags) { const query = requireArg([args.join(" ")], 0, "query"); @@ -384,6 +417,14 @@ export const commands: CommandDefinition[] = [ page={optPage(flags)} per={optPer(flags)} type={flag(flags, "type")} + sort={flagAs(flags, "sort")} + scope={flagAs(flags, "scope")} + ext={flagAs(flags, "ext")} + after={flag(flags, "after")} + seed={intFlag(flags, "seed")} + userId={intFlag(flags, "user-id")} + groupId={intFlag(flags, "group-id")} + channelId={intFlag(flags, "channel-id")} /> ); },