diff --git a/crates/idx-cli/src/cli/config.rs b/crates/idx-cli/src/cli/config.rs index 976c54a..95c6c79 100644 --- a/crates/idx-cli/src/cli/config.rs +++ b/crates/idx-cli/src/cli/config.rs @@ -5,7 +5,11 @@ use crate::output::{OutputSetting, json}; use idx_core::error::IdxError; #[derive(Debug, Args)] -#[command(about = "Manage configuration")] +#[command( + about = "Manage configuration", + long_about = "Manage configuration in ~/.config/idx/config.toml (or $XDG_CONFIG_HOME/idx/config.toml).\n\nResults print as plain text, even when piped, so `$(idx config path)` works in scripts. Ask for JSON with `-o json`, `IDX_OUTPUT=json`, or `general.output = \"json\"`.", + after_help = "Keys:\n general.provider, general.history_provider, general.exchange, general.output,\n general.color, cache.quote_ttl, cache.fundamental_ttl, ownership.db_path,\n ownership.snapshot_manifest\n\nExamples:\n idx config init\n idx config set general.output json\n idx config get cache.quote_ttl\n idx config path" +)] pub struct ConfigCmd { #[command(subcommand)] pub command: ConfigSubcommand, @@ -16,9 +20,16 @@ pub enum ConfigSubcommand { #[command(about = "Create default configuration file")] Init, #[command(about = "Get a configuration value by key")] - Get { key: String }, + Get { + /// Key such as general.provider (see `idx config --help`). + key: String, + }, #[command(about = "Set a configuration value by key")] - Set { key: String, value: String }, + Set { + /// Key such as general.provider (see `idx config --help`). + key: String, + value: String, + }, #[command(about = "Print configuration file path")] Path, } diff --git a/crates/idx-cli/src/cli/ownership.rs b/crates/idx-cli/src/cli/ownership.rs index 9ef70cd..125952f 100644 --- a/crates/idx-cli/src/cli/ownership.rs +++ b/crates/idx-cli/src/cli/ownership.rs @@ -50,8 +50,15 @@ pub enum OwnershipCommand { /// Show all holders for a ticker (KSEI + Bing combined). Ticker(TickerArgs), /// Show all holdings for an entity across tickers. + #[command( + after_help = "Examples:\n idx ownership entity \"ASTRA INTERNATIONAL\"\n idx ownership search astra # list candidates first" + )] Entity(EntityArgs), - /// Search entities by name. + /// Search entities by name or KSEI alias. + #[command( + long_about = "Search entities by name or KSEI alias.\n\nMatches canonical names and the raw names KSEI prints (e.g. `PT ASTRA INTERNATIONAL TBK`), case-insensitively. Ranked: exact name, exact alias, prefix, then substring.", + after_help = "Examples:\n idx ownership search astra\n idx ownership search \"PT ASTRA INTERNATIONAL TBK\" --limit 5" + )] Search(SearchArgs), /// Rank entities by cross-ownership breadth. CrossHolders(CrossHolderArgs), @@ -60,6 +67,10 @@ pub enum OwnershipCommand { /// Show Bing institutional flow for a ticker. Flow(FlowArgs), /// Diff two KSEI releases. + #[command( + long_about = "Diff two KSEI releases: new, exited, increased, and decreased holders.\n\nBoth dates must be imported releases (`idx ownership releases` lists them), with --from before --to. A holder's accounts in a ticker are summed, so an investor with several accounts compares by its total stake.", + after_help = "Examples:\n idx ownership releases\n idx ownership changes --from 2026-08-31 --to 2026-09-30" + )] Changes(ChangesArgs), /// Ownership network graph. Graph(GraphArgs), @@ -114,11 +125,13 @@ pub struct TickerArgs { #[derive(Debug, Args)] pub struct EntityArgs { + /// Entity name or part of one, case-insensitive; the shortest match is shown. pub name: String, } #[derive(Debug, Args)] pub struct SearchArgs { + /// Name, KSEI alias, or part of one. pub query: String, #[arg(long, default_value_t = 20)] pub limit: usize, @@ -147,8 +160,10 @@ pub struct FlowArgs { #[derive(Debug, Args)] pub struct ChangesArgs { + /// Earlier release date, YYYY-MM-DD. #[arg(long)] pub from: String, + /// Later release date, YYYY-MM-DD. #[arg(long)] pub to: String, } diff --git a/crates/idx-cli/tests/golden/help-config.golden b/crates/idx-cli/tests/golden/help-config.golden index e594fbc..845a21d 100644 --- a/crates/idx-cli/tests/golden/help-config.golden +++ b/crates/idx-cli/tests/golden/help-config.golden @@ -1,6 +1,8 @@ exit: 0 --- stdout -Manage configuration +Manage configuration in ~/.config/idx/config.toml (or $XDG_CONFIG_HOME/idx/config.toml). + +Results print as plain text, even when piped, so `$(idx config path)` works in scripts. Ask for JSON with `-o json`, `IDX_OUTPUT=json`, or `general.output = "json"`. Usage: idx config [OPTIONS] @@ -12,11 +14,37 @@ Commands: help Print this message or the help of the given subcommand(s) Options: - -o, --output Output format [default: auto = table on a terminal, json when piped] [possible values: auto, table, json, jsonl] - --no-color Disable colored output - -q, --quiet Suppress non-essential output - -v, --verbose... Increase verbosity (-v, -vv) - --offline Run without network requests - --no-cache Bypass local cache - -h, --help Print help + -o, --output + Output format [default: auto = table on a terminal, json when piped] + + [possible values: auto, table, json, jsonl] + + --no-color + Disable colored output + + -q, --quiet + Suppress non-essential output + + -v, --verbose... + Increase verbosity (-v, -vv) + + --offline + Run without network requests + + --no-cache + Bypass local cache + + -h, --help + Print help (see a summary with '-h') + +Keys: + general.provider, general.history_provider, general.exchange, general.output, + general.color, cache.quote_ttl, cache.fundamental_ttl, ownership.db_path, + ownership.snapshot_manifest + +Examples: + idx config init + idx config set general.output json + idx config get cache.quote_ttl + idx config path --- stderr diff --git a/crates/idx-cli/tests/golden/help-ownership.golden b/crates/idx-cli/tests/golden/help-ownership.golden index 54501d7..a7e4741 100644 --- a/crates/idx-cli/tests/golden/help-ownership.golden +++ b/crates/idx-cli/tests/golden/help-ownership.golden @@ -15,7 +15,7 @@ Commands: sync Install or refresh a maintained ownership SQLite snapshot ticker Show all holders for a ticker (KSEI + Bing combined) entity Show all holdings for an entity across tickers - search Search entities by name + search Search entities by name or KSEI alias cross-holders Rank entities by cross-ownership breadth concentration Rank tickers by ownership concentration flow Show Bing institutional flow for a ticker diff --git a/web/src/content/docs/cli/reference.md b/web/src/content/docs/cli/reference.md index 2236c01..095347b 100644 --- a/web/src/content/docs/cli/reference.md +++ b/web/src/content/docs/cli/reference.md @@ -463,7 +463,9 @@ Examples: ## `idx config` ```text -Manage configuration +Manage configuration in ~/.config/idx/config.toml (or $XDG_CONFIG_HOME/idx/config.toml). + +Results print as plain text, even when piped, so `$(idx config path)` works in scripts. Ask for JSON with `-o json`, `IDX_OUTPUT=json`, or `general.output = "json"`. Usage: idx config [OPTIONS] @@ -475,13 +477,39 @@ Commands: help Print this message or the help of the given subcommand(s) Options: - -o, --output Output format [default: auto = table on a terminal, json when piped] [possible values: auto, table, json, jsonl] - --no-color Disable colored output - -q, --quiet Suppress non-essential output - -v, --verbose... Increase verbosity (-v, -vv) - --offline Run without network requests - --no-cache Bypass local cache - -h, --help Print help + -o, --output + Output format [default: auto = table on a terminal, json when piped] + + [possible values: auto, table, json, jsonl] + + --no-color + Disable colored output + + -q, --quiet + Suppress non-essential output + + -v, --verbose... + Increase verbosity (-v, -vv) + + --offline + Run without network requests + + --no-cache + Bypass local cache + + -h, --help + Print help (see a summary with '-h') + +Keys: + general.provider, general.history_provider, general.exchange, general.output, + general.color, cache.quote_ttl, cache.fundamental_ttl, ownership.db_path, + ownership.snapshot_manifest + +Examples: + idx config init + idx config set general.output json + idx config get cache.quote_ttl + idx config path ``` ### `idx config init` @@ -509,7 +537,7 @@ Get a configuration value by key Usage: idx config get [OPTIONS] Arguments: - + Key such as general.provider (see `idx config --help`) Options: -o, --output Output format [default: auto = table on a terminal, json when piped] [possible values: auto, table, json, jsonl] @@ -529,7 +557,7 @@ Set a configuration value by key Usage: idx config set [OPTIONS] Arguments: - + Key such as general.provider (see `idx config --help`) Options: @@ -633,7 +661,7 @@ Commands: sync Install or refresh a maintained ownership SQLite snapshot ticker Show all holders for a ticker (KSEI + Bing combined) entity Show all holdings for an entity across tickers - search Search entities by name + search Search entities by name or KSEI alias cross-holders Rank entities by cross-ownership breadth concentration Rank tickers by ownership concentration flow Show Bing institutional flow for a ticker @@ -833,7 +861,7 @@ Show all holdings for an entity across tickers Usage: idx ownership entity [OPTIONS] Arguments: - + Entity name or part of one, case-insensitive; the shortest match is shown Options: -o, --output Output format [default: auto = table on a terminal, json when piped] [possible values: auto, table, json, jsonl] @@ -843,27 +871,55 @@ Options: --offline Run without network requests --no-cache Bypass local cache -h, --help Print help + +Examples: + idx ownership entity "ASTRA INTERNATIONAL" + idx ownership search astra # list candidates first ``` ### `idx ownership search` ```text -Search entities by name +Search entities by name or KSEI alias. + +Matches canonical names and the raw names KSEI prints (e.g. `PT ASTRA INTERNATIONAL TBK`), case-insensitively. Ranked: exact name, exact alias, prefix, then substring. Usage: idx ownership search [OPTIONS] Arguments: + Name, KSEI alias, or part of one Options: - --limit [default: 20] - -o, --output Output format [default: auto = table on a terminal, json when piped] [possible values: auto, table, json, jsonl] - --no-color Disable colored output - -q, --quiet Suppress non-essential output - -v, --verbose... Increase verbosity (-v, -vv) - --offline Run without network requests - --no-cache Bypass local cache - -h, --help Print help + --limit + [default: 20] + + -o, --output + Output format [default: auto = table on a terminal, json when piped] + + [possible values: auto, table, json, jsonl] + + --no-color + Disable colored output + + -q, --quiet + Suppress non-essential output + + -v, --verbose... + Increase verbosity (-v, -vv) + + --offline + Run without network requests + + --no-cache + Bypass local cache + + -h, --help + Print help (see a summary with '-h') + +Examples: + idx ownership search astra + idx ownership search "PT ASTRA INTERNATIONAL TBK" --limit 5 ``` ### `idx ownership cross-holders` @@ -927,20 +983,45 @@ Options: ### `idx ownership changes` ```text -Diff two KSEI releases +Diff two KSEI releases: new, exited, increased, and decreased holders. + +Both dates must be imported releases (`idx ownership releases` lists them), with --from before --to. A holder's accounts in a ticker are summed, so an investor with several accounts compares by its total stake. Usage: idx ownership changes [OPTIONS] --from --to Options: --from - -o, --output Output format [default: auto = table on a terminal, json when piped] [possible values: auto, table, json, jsonl] - --no-color Disable colored output + Earlier release date, YYYY-MM-DD + + -o, --output + Output format [default: auto = table on a terminal, json when piped] + + [possible values: auto, table, json, jsonl] + + --no-color + Disable colored output + --to - -q, --quiet Suppress non-essential output - -v, --verbose... Increase verbosity (-v, -vv) - --offline Run without network requests - --no-cache Bypass local cache - -h, --help Print help + Later release date, YYYY-MM-DD + + -q, --quiet + Suppress non-essential output + + -v, --verbose... + Increase verbosity (-v, -vv) + + --offline + Run without network requests + + --no-cache + Bypass local cache + + -h, --help + Print help (see a summary with '-h') + +Examples: + idx ownership releases + idx ownership changes --from 2026-08-31 --to 2026-09-30 ``` ### `idx ownership graph`