kx state
Shows the listing that indexes currently resolve against.
kx keeps a stack of recent kx get results — max_history of them, 10 by default — with a cursor marking the current one. --all lists the stack, a position jumps to an entry, and back/forward step through it.
Re-running the listing you are already on refreshes that entry rather than pushing another copy, so the stack holds distinct views and back reaches the one before.
Namespaces and contexts sit in slots of their own, outside that stack: kx ns 2 counts against the namespaces you last listed however much you have listed since, and switching namespace never pushes work off the stack. --targets expands both slots, so you can pick a number without listing again.
--json prints the current entry, or the stack with --all, as a document for a script: each row’s index, kind, name and namespace, and each entry’s context, query and provenance. Like kx ref, it never contacts the cluster.
To act on a namespace rather than switch to it, list it with kx get ns. That stacks it like any other listing — kx describe 2, kx label 2 — and refreshes the slot too, so the two spellings never disagree about what 2 means.
Usage
kx state [OPTIONS] [position]Subcommands
| Command | Description |
|---|---|
kx state back | Navigate to the previous kx get result. |
kx state drop | Remove a history entry by position (shown in kx state --all); --empty drops the entries that found nothing, --all clears everything but marks. |
kx state forward | Navigate to the next kx get result. |
Arguments
| Argument | Description |
|---|---|
[position] | History position, as numbered by kx state --all |
Options
| Option | Description |
|---|---|
-a, --all | Show the full history stack |
--json | Print the current entry, or the stack with --all, as JSON instead of a table |
-t, --targets | Show the namespace and context listings the switch commands index into |
Global options
| Option | Description |
|---|---|
--no-color | Disable styled output |
-h, --help | Show this message and exit |
Examples
kx state
kx state --all
kx state --targets
kx state 2
kx state --all --json